akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

typedef struct {
    int ax, ay;
    int bx, by;
    int time;
} TWIN;

TWIN queue[300000];
int head, tail;

void enq(TWIN t)
{
    queue[(tail++) % 300000] = t;
}

void deq(TWIN *t)
{
    *t = queue[(head++) % 300000];
}

int main(void)
{
    TWIN first, temp;
    int x, y;
    int i, j;
    int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
    char map[51][51];
    static char v[51][51][51][51];
    int flag;
    
    while (1){
        scanf("%d%d", &x, &y);
        
        if (x + y == 0){
            break;
        }
        
        scanf("%d%d", &first.ax, &first.ay);
        scanf("%d%d", &first.bx, &first.by);
        
        first.ax -= 1;
        first.ay -= 1;
        first.bx -= 1;
        first.by -= 1;
        
        for (i = 0; i < y; i++){
            for (j = 0; j < x; j++){
                scanf("%d", &map[i][j]);
            }
        }
        first.time = temp.time = 0;
        head = tail = 0;
        memset(v, 0, sizeof(v));
        v[first.ay][first.ax][first.by][first.bx] = 1;
        enq(first);
        flag = 0;
        while (head != tail){
            deq(&temp);
            
            if (temp.time >= 100){
                break;
            }
            
            if (temp.ax == temp.bx && temp.ay == temp.by){
                printf("%d\n", temp.time);
                flag = 1;
                break;
            }
            
            for (i = 0; i < 4; i++){
                first = temp;
                if (0 <= first.ax + dx[i] && first.ax + dx[i] < x && 0 <= first.ay + dy[i] && first.ay + dy[i] < y && map[first.ay + dy[i]][first.ax + dx[i]] == 0){
                    first.ax += dx[i];
                    first.ay += dy[i];
                }
                if (0 <= first.bx - dx[i] && first.bx - dx[i] < x && 0 <= first.by - dy[i] && first.by - dy[i] < y && map[first.by - dy[i]][first.bx - dx[i]] == 0){
                    first.bx -= dx[i];
                    first.by -= dy[i];
                }
                first.time++;
                if (!v[first.ay][first.ax][first.by][first.bx]){
                    v[first.ay][first.ax][first.by][first.bx] = 1;
                    enq(first);
                }
            }
        }
        if (!flag){
            printf("NA\n");
        }
    }
    
    return (0);
}

Measured memory_bytes: 0
import Control.Applicative
import Control.Monad
import Data.Char (ord, chr)

main :: IO ()
main = do
  s <- getLine
  unless (s == ".") $ do
    putStrLn $ solve s
    main

solve :: String -> String
solve = f [] 0
  where
    f st _ [] = reverse st
    f st d (c:cs)
      | c == '[' = f (c:st) 0 cs
      | c == '+' = f st (d + 1) cs
      | c == '-' = f st (d - 1) cs
      | c == ']' = let (as, _:bs) = break (== '[') st
                   in f (reverse as ++ bs) 0 cs
      | otherwise = f (g d c : st) 0 cs
    g d c
      | c == '?' = 'A'
      | otherwise = let i = (ord c - ord 'A' + d) `mod` 26
                    in chr $ ord 'A' + i



Measured memory_bytes: 4032
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <sstream>
using namespace std;

typedef long long i64;
const int inf = (int)1.05e9;


int main()
{
	int h, w;

	scanf("%d%d", &h, &w);

	for(int x = 0; x < h; ++x) {
		for(int y = 0; y < w; ++y) {
			char buffer[127];
			scanf("%s", buffer);
			if(strcmp(buffer, "snuke") == 0) {
				printf("%c%d\n", 'A' + y, x + 1);
				return 0;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <string>

using namespace std;

void solve();

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

void solve() {
    int N;
    string s,t;
    cin >> N;
    cin >> s >> t;
    int ans = N * 2;
    for(int i = 0; i < N; i++) {
        bool ok = true;
        for(int j = 0; j < N - i; j++) {
            if(s[i + j] != t[j]) {
                ok = false;
                break;
            }
        }
        if(ok) {
            ans = N * 2 - (N - i);
            break;
        }
    }
    cout << ans << endl; 


    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        if (Math.abs(a - c) <= d || (Math.abs(a - b) <= d && Math.abs(b - c) <= d)) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }

}


Measured memory_bytes: 20948
#include<bits/stdc++.h>
#define ll 				long long
#define ld 				long double
#define fastio 			ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) 		cerr<<#x<<" "<<x<<endl
#define cina(a,n) 		for(ll i = 0;i<n;i++)	cin>>a[i];
#define couta(a,n) 		for(ll i = 0;i<n;i++) cout<<a[i]<<" ";
#define fauto(ar)		for(auto x : ar)	cout<<x<<" ";
#define mod 			1000000007
#define inf				100100100100100100
#define siz 			100005
#define f 				first
#define s 				second
#define pb 				push_back
#define endl 			"\n"
#define ci 				cin.ignore()
using namespace std;
ll dp[405][405],prefixsum[405];
ll getsum(ll i,ll j)
{
	if(i == 0)
	return prefixsum[j];
	return prefixsum[j] - prefixsum[i-1];
}
ll getans(ll *a,ll i,ll j)
{
	if(i >= j)
	return 0;
	if(dp[i][j] != -1)
	return dp[i][j];
	ll k,ans = inf,curr;
	for(k=i;k<j;k++)
	{
		curr = getans(a,i,k) + getans(a,k+1,j) + getsum(i,j);
		ans = min(ans,curr);
	}
	return dp[i][j] = ans;
}
int main()
{
	ll n,i,j;
	cin>>n;
	ll a[n];
	cina(a,n);
	
	prefixsum[0] = a[0];
	for(i=1;i<n;i++)
	prefixsum[i] = prefixsum[i-1] + a[i];
	
	for(i = 0;i<n;i++)
	for(j = 0;j<n;j++)
	dp[i][j] = -1;
	
	cout<<getans(a,0,n-1);
	

	
}

Measured memory_bytes: 4920
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline int read()
{
	int s=0,f=1; char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=5e3+20;

int n,mod;
int dp[maxn];

inline void init()
{
	n=read();mod=read();
}

inline void pls(int &a,int b){ a+=b; a-=a>=mod?mod:0;}

int f[maxn][maxn];

inline void doing()
{
	int len=n-1>>1;
	dp[0]=1;
	REP(i,1,len+(~n&1))
	{
		int w=i;
		for(int j=w;j<=n;j++)
			pls(dp[j],dp[j-w]);
	}
	f[0][0]=1;
	REP(i,1,n)
	{
		REP(j,0,n)f[i][j]=f[i-1][j];
		REP(j,i,n)pls(f[i][j],f[i][j-i]);
	}
	DREP(i,n,1)
	{
		int s=0;
		REP(j,0,n)
		{
			pls(s,f[i-1][j]);
			int nj=j+len+1;
			if(nj<=n)pls(f[i][nj],mod-s);
		}
	}
	int ans=0;
	REP(x,1,n)
	{
		int a=x-1,mx=n-x;
		int suf=0;
		DREP(j,a,0)
		{
			suf=(suf+dp[a-j])%mod;
			ans=(ans+(ll)suf*f[mx][j])%mod;
		}
	}
	printf("%d\n",ans);
}

int main()
{

	init();
	doing();
	return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong a,b;
	cin >> a >> b;
	cout << (a+b)/2 << endl;

	return 0;
}


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

/*#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")   */


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

using namespace std;
//using namespace __gnu_pbds;

#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back

const int N = 2e6 + 51, MOD = 1e9 + 7, mod = 998244353, INF = 2e18;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;

int d[200][200], dx[] = {1, 0}, dy[] = {0, 1}, n, m;
char c[200][200];

bool check (int v, int v1) {
    if (v <= 0 || v > n || v1 > m || v1 <= 0) return false;
    return true;
}

void bfs (int v, int v1) {
    deque <pair <int, int>> q;
    q.push_back({v, v1});
    if (c[v][v1] == '#') d[v][v1] = 1;
    else d[v][v1] = 0;
    while (!q.empty()) {
        auto to = q.front();
        q.pop_front();
        for (int i = 0; i < 2; i++) {
            int x = to.ff + dx[i], y = to.ss + dy[i];
            if (check(x, y)) {
                int k = 0;
                if (c[to.ff][to.ss] != '#' && c[x][y] == '#') k = 1;
                if (d[to.ff][to.ss] + k < d[x][y]) {
                    d[x][y] = d[to.ff][to.ss] + k;
                    if (k) q.push_back({x, y});
                    else q.push_front({x, y});
                }

            }
        }

    }

}


signed main() {
    #ifdef Flash
     freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> c[i][j];
            d[i][j] = INF;
        }
    }
    bfs(1, 1);
    cout << d[n][m];
}


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

int main() {
	int n;
	cin >> n;
	map<int, int> m;
	for (int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		m[a]++;
	}
	int k = m.size();
	cout << ([&]()->int {
		if (k > 3) return 0;
		if (k < 2)
			return !m.begin()->first;
		if (n % 3) return 0;
		auto i = m.begin();
		int x = i->first;
		++i;
		int y = i->first;
		if (k < 3) {
			if (x&&y) return 0;
			if (m[0] == n / 3) return 1;
			return 0;
		}
		++i;
		int z = i->first;
		if (x^y^z) return 0;
		if (m[x] == m[y] && m[x] == m[z]) return 1;
		return 0;
	}() ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long n,gcd,i,x;
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>x;
        if(i==0) gcd=x;
        else gcd=__gcd(x,gcd);

    }
    cout<<gcd<<endl;
}


Measured memory_bytes: 256
b1,b2,b3=map(int,input().split())

if b1==1 and b2==0 and b3==0:
    print('Close')
if b1==0 and b2==1 and b3==0:
    print('Close')
if b1==1 and b2==1 and b3==0:
    print('Open')
if b1==0 and b2==0 and b3==1:
    print('Open')
if b1==b2==b3==0:
    print('Close')


Measured memory_bytes: 5596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AABC
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] kk = Console.ReadLine().Split(' ');
            int[] abc = new int[3];

            for(int k = 0; k < 3; k++)
            {
                abc[k] = int.Parse(kk[k]);
            }
            Array.Sort(abc);

            Console.WriteLine((abc[2]*10 + abc[1]) + abc[0]);
        }
    }
}


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

int i, o, t, j, l, s, z;
long long ans;

int main() {
	cin >> i >> o >> t >> j >> l >> s >> z;
	ans = o;
	if (i && j && l && (i & 1) + (j & 1) + (l & 1) > 1) {
		ans+=3;
		i--;
		j--;
		l--;
	}
	ans += i / 2 * 2;
	ans += j / 2 * 2;
	ans += l / 2 * 2;
	cout << ans << endl;
}


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

int main() {
  string s; cin >> s;
  rep(i, s.length()) {
    if(s[i] == ',')s[i] = ' ';
  }
  
  cout << s << endl;
}

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

using namespace std;

void insertionSort(vector<int> A);
void printVector(vector<int> A);

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

	vector<int> A(N);
	for(auto&& e : A) {
		cin >> e;
	}

	printVector(A);
	insertionSort(A);

	return 0;
}

void insertionSort(vector<int> A) {
	int i, j, v;

	for(i = 1; i < A.size(); ++i) {
		v = A[i];
		j = i - 1;

		while((0 <= j) && (v < A[j])) {
			A[j + 1] = A[j];
			--j;
		}

		A[j + 1] = v;

		printVector(A);
	}
}

void printVector(vector<int> A) {
	for(int i = 0; i < A.size(); ++i) {
		cout << A[i];
		if(A.size() - 1 > i) { cout << " "; }
		else{ cout << endl; }
	}
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n, m; cin >> n >> m;
    const ll inf = (ll) 1e15;
    vector<ll> dp((1 << 13), inf), all;
    vector<pair<ll, ll>> a;
    for (int i = 0; i < m; i++) {
        ll x, y; cin >> x >> y;
        a.emplace_back(x, y);
        bitset<20> b;
        for (int j = 0; j < y; j++) {
            int x; cin >> x;
            b[x - 1] = 1;
        }
        all.push_back(b.to_ullong());
        dp[all.back()] = min(dp[all.back()], x);
    }
    for (ll msk = 0; msk <= (1 << n); msk++) {
        if (dp[msk] != inf) {
            for (int i = 0; i < m; i++) {
                ll other = (msk | all[i]);
                ll cost = dp[msk] + a[i].first;
                dp[other] = min(dp[other], cost);
            }
        }
    }
    cout << (dp[(1 << n) - 1] == inf ? -1ll : dp[(1 << n) - 1]) << "\n";
}


Measured memory_bytes: 384
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <memory>        // unique_ptr, shared_ptr, weak_ptr
#include <cstring>
#include <cmath>

using namespace std;

using ll = long long int;
using vi = vector<int>;
using vvi = vector<vi>;

#define _LIBCPP_DEBUG 0
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
	long long a, b, cnt=0;
	bool zflg=false;
	cin >> a >> b;

	for (long long i=a; i<b+1; i++) {
		if (i < 0) cnt++;
		else if (i == 0) zflg = true;
	}

	if (zflg) {
		cout << "Zero" << endl;
	} else {
		if (cnt % 2 == 0) cout << "Positive" << endl;
		else if (cnt % 2 == 1) cout << "Negative" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3080
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int leg = sc.nextInt();
        if(leg % 2 == 1){
        	System.out.println("No");
        }else if(leg < 2 * n){
        	System.out.println("No");
        }else if(leg > 4 * n){
        	System.out.println("No");
        }else{
        	System.out.println("Yes");
        }
	}
}

Measured memory_bytes: 35856
n = int(input())
X = [int(i) for i in input().split()]
X_s = sorted(X)

x1 = X_s[(n//2)-1]
x2 = X_s[n//2]

for x in X:
    if x <= x1:
        print(x2)
    else:
        print(x1)
        



Measured memory_bytes: 26772
A, B, C, X, Y = map(int, input().split())

ans = 10**20
for i in range(max(X, Y) * 2 + 1):
    c = i
    a = X - i // 2
    if a < 0:
        a = 0
    b = Y - i // 2
    if b < 0:
        b = 0
    v = a * A + b * B + c * C
    if v < ans:
        ans = v

print(ans)


Measured memory_bytes: 9112
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, l = na()
s = nsn(n)
s.sort()

print(*s, sep="")



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

int main(void){
    int a,b;
    cin >> a >> b;
    int ans = a*b-a-b+1;
    cout << ans <<endl;
    return 0;
}















































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


int main(){
    string s; 
    cin >> s;
    
    if (s == string("SUN")) {cout << 7;}
    if (s == string("MON")) cout << 6;
    if (s == string("TUE")) cout << 5;
    if (s == string("WED")) cout << 4;
    if (s == string("THU")) cout << 3;
    if (s == string("FRI")) cout << 2;
    if (s == string("SAT")) cout << 1;
    return 0;
}

Measured memory_bytes: 256
module Main where

import Debug.Trace

main :: IO ()
main = do
  getLine
  s <- parse <$> getLine
  --s `traceShow` (putStrLn . decode) $ solve s
  (putStrLn . decode) $ solve s

parse :: String -> [Bool]
parse s = map (\a -> a == 'o') s

decode :: [Bool] -> String
decode [] = "-1"
decode s = map (\a -> if a  then 'S' else 'W') s 

solve :: [Bool] -> [Bool]
solve s = if null cand then [] else (head cand)
  where
    start_pattern = [[True, True], [True, False], [False, True], [False, False]]
    s' = tail s ++ [head s]
    cand = filter (not . null) . map (\p -> let p' = (build s' p) in if valid p p' then (reverse . tail . tail $ p') else []) $ start_pattern

build :: [Bool] -> [Bool] -> [Bool]
build (t:ts) cand@(c:s:ss)
  |     t &&     c = build ts (    s:cand)
  | not t &&     c = build ts (not s:cand)
  |     t && not c = build ts (not s:cand)
  | not t && not c = build ts (    s:cand)
  | otherwise = undefined
build [] cand = cand

valid :: [Bool] -> [Bool] -> Bool
valid (p1:p2:_) (c1:c2:_) = p1 == c1 && p2 == c2
valid _ _ = undefined


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

// defines
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define casti static_cast<int>
#define cast static_cast
#define ll long long int
#define vi vector<int>
#define vpi vector<pair<int,int >>
#define v vector
#define forl(n) for(int i=0;i<n;i++)
#define fora(a,b,c) for(int i=a;i<b;i+=c)

using namespace std;

ll modF=1e18l+1l;

// topcoder



//codechef and codeforces and atcoder

void solve(){
	ll n;
	cin >> n;
	ll a[n];
	ll prod = 1;
	ll result;
	int h0 = 0;
	forl(n){
		cin >> a[i];
		if(a[i] == 0){
			h0 = 1;
		}
	}
	if(h0){
		cout << "0\n";
		return; 
	}
	forl(n){
		result = (prod * a[i]) % modF;
		if(prod == result / a[i])
			prod = result;
		else{
			prod = -1;
			break;
		}
	}
	cout << prod << "\n";
}


int main(){
    boost_io;
    solve();
} 


Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
int main() {
 int N;
 cin>>N;
 vector<string>S(N);
 vector<int>ans(26);
 rep(i,N){
      vector<int>cnt(26);
   	rep(j,26){
    cnt[j]=0;}
    cin>>S[i];
   string C=S[i];
    rep(j,C.size()){
        cnt[int(C[j])-97]++;
    }
    if(i==0){
        rep(i,26){
            ans[i]=cnt[i];
        }
    }
    else{
        rep(i,26){
            if(cnt[i]<ans[i]){
                ans[i]=cnt[i];
            }
        }
    }
 }
 rep(i,26){
     rep(j,ans[i]){
cout<<char(i+97);
     }
 }
 cout<<""<<endl;
}


Measured memory_bytes: 3652
L = []
S = []
N, M = map(int, input().split())
cnt = 0
ans = 0
for i in range(M):
    l = list(map(int, input().split()))
    L.append(l)
p = list(map(int, input().split()))

for j in range(2**N):
    switch = [0]*N
    for k in range(N):
        if (j >> k) & 1:
            switch[k-1]=1
    S.append(switch)
    #ここまでで全パターン
#あるパターンにおいて全点灯しているか？

for i in range(2**N):
    I = [0]*M
    cnt = 0
    for k in range(M):
        for x in range(1, len(L[k])):
            if S[i][L[k][x]-1]==1:
                I[k]+=1
    for i in range(M):
        if I[i]%2==p[i]:
            cnt +=1
    if cnt == M:
        ans +=1
print(ans)

Measured memory_bytes: 3188
#include <stdio.h>

int main(){
  int n, x, y, h, w, s, p;

  while(scanf("%d", &n) && n){
    p = 0;
    while(n--){
      scanf("%d%d%d%d", &x, &y, &h, &w);
      s = x + y + h;
      if(s <= 60 && w <= 2) p += 600;
      else if(s <= 80 && w <= 5) p += 800;
      else if(s <= 100 && w <= 10) p += 1000;
      else if(s <= 120 && w <= 15) p += 1200;
      else if(s <= 140 && w <= 20) p += 1400;
      else if(s <= 160 && w <= 25) p += 1600;
    }

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

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

using namespace std;

#define ll long long

void solve() {
	int n;
	cin >> n;
	int sum = 0;
	string s = to_string(n);
	for (int i = 0; i < s.length(); i++) {
		sum += s[i] - '0';
	}
	cout << (n%sum == 0 ? "Yes" : "No") << "\n";
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 3712
#include <iostream>
     
    using namespace std;
     
    int main() {
      int a, b;
      cin >> a >> b;
      if (a + b == 15) cout << "+" << endl;
      else if (a * b == 15) cout << "*" << endl;
      else cout << "x" << endl;
      return 0;
    }

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

using namespace std;
int main ()
{
  vector<int> vector;
  int n;
  int size;
  int counter=0;
  int temp=0;
//   vector<vector<int>> counter;
  cin>>size;//do nothing
  // int(vector.size()) 

    for(int i=0;i<size;++i){
        cin >> n;
        vector.push_back (n);
    }

    
    for(int i=0; i<size-1; ++i){
        if(vector[i]>vector[i+1]){
            ++counter;
        }
        else if(vector[i]==vector[i+1]){
            ++counter;
        }
        else{
            counter=0;
        } temp =max(temp,counter);
        
    }
    cout<<temp<<endl;
    return 0;
}
 

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	VL p(n);
	cin >> p;
	int c = 0;
	for (int i = 0; i < n; i++) {
		if (p[i] != i+1) {
			c++;
		}
	}
	if (c == 0 or c == 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
<?php

list($k, $n) = explode(' ', trim(fgets(STDIN)));

$a_list = explode(' ', trim(fgets(STDIN)));

$distance_list = [];
for ($i = 1; $i <= $n - 1; ++$i) {
    $distance_list[] = $a_list[$i] - $a_list[$i - 1];
}

$distance_list[] = $k - $a_list[$n - 1] + $a_list[0];

echo array_sum($distance_list) - max($distance_list);


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

int main() {
	int a, b;
	cin >> a >> b;
	int plag = 1;
	int count = 0;
	rep(i, 30) {
		if (plag < b) { 
			plag += a - 1; 
			count++;
		}
		else break;

	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

int main(){

	string s, t;
	cin >> s >> t;
	ll count = 0, ans = INT_MAX;
	ll n = s.length(), m = t.length();
	for(int i = 0; i < n - m + 1; ++i){
		count = 0;
		for(int j = 0; j < m; ++j){
			if(s[i+j] == t[j]){
				count++;
			}
		}
		int temp = m - count;
		if(temp < ans){
			ans = temp;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<string.h>
using namespace std;

int main()
{
	char s[21];
	cin.getline(s, 21, '\n');
	int l = strlen(s);
	for (int i = l - 1; i >= 0; i--)
		cout << s[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 1120
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int a, b;
    cin>>a>>b;

    cout<<max(a - 2*b, 0LL);
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <algorithm>

int main()
{
    int64_t m, ct = 0, ch = 0;
    std::cin >> m;
    for (int64_t i = 0; i < m; i++)
    {
        std::vector<std::string> vs(2);
        std::string s1, s2;
        std::cin >> s1 >> s2;
        vs[0] = s1;
        vs[1] = s2;
        std::sort(vs.begin(), vs.end());
        if (s2 == s1)
        {
            ct += 1;
            ch += 1;
        }
        else if(s1 == vs[1]){
            ct += 3;
        }
        else
        {
            ch += 3;
        }
    }
    std::cout << ct << " " << ch << "\n";
    return 0;
}


Measured memory_bytes: 3096
#include<stdio.h>

int main(){
	long long int n,a,s=0,b;
	scanf("%lld",&n);
	b=n;
	while(b>0){
		a=b%10;
		s+=a;
		b=b/10;
	}
	//printf("%lld\n",s);
	if(n%s==0)printf("Yes\n");
	else printf("No\n");
	return 0;
}
	


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int l=0,r=n-1,mid;
	vector<int> cnt(n,INF);
	auto check=[](string s){
		if(s=="Vacant"){
			return 0;
		}else if(s=="Male"){
			return 1;
		}else{
			return -1;
		}
	};
	string s;
	cout<<l<<endl;
	cin>>s;
	cnt[l]=check(s);
	if(cnt[l]==0){
		cout<<l<<endl;
		return 0;
	}
	cout<<r<<endl;
	cin>>s;
	cnt[r]=check(s);
	if(cnt[r]==0){
		cout<<r<<endl;
		return 0;
	}
	while(r-l>1){
		mid=(l+r)/2;
		cout<<mid<<endl;
		cin>>s;
		cnt[mid]=check(s);
		if(cnt[mid]==0){
			cout<<mid<<endl;
			return 0;
		}
		if((mid-l+1)%2==0){
			if(cnt[l]==cnt[mid]){
				r=mid;
			}else{
				l=mid;
			}
		}else{
			if(cnt[l]!=cnt[mid]){
				r=mid;
			}else{
				l=mid;
			}
		}
	}
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    ll N, M, K; cin >> N >> M >> K;
    vector<ll> A(N + 1), B(M + 1);
    A[0] = 0, B[0] = 0;
    for(ll i = 1; i <= N; i++) {
        ll a; cin >> a;
        A[i] = A[i - 1] + a;
    } 
    for(ll i = 1; i <= M; i++) {
        ll b; cin >> b;
        B[i] = B[i - 1] + b;
    }
    ll sum = 0, ans = 0, cnt = 0;
    for(int i = N; i >= 0; i--) {
        sum = A[i];
        cnt = i;
        if(sum > K) continue;
        else {
            auto itr = upper_bound(B.begin(), B.end(), K - sum) - B.begin();
            cnt += (ll)itr - 1;
        }
        ans = max(ans, cnt);
    } 
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6404
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
  int n, data[6];
  map< string , int* > dice;
  dice["上"] = &data[0]; //あえて日本語()
  dice["北"] = &data[1];
  dice["西"] = &data[2];
  dice["東"] = &data[3];
  dice["南"] = &data[4];
  dice["下"] = &data[5];


  while(cin >> n, n){
    for(int i = 0 ; i < 6 ; i++ ){
      data[i] = i + 1;
    }

    while(n--){
      string s;
      cin >> s;
      if(s == "north"){
        *dice["北"] = *dice["上"];
        *dice["上"] = *dice["南"];
        *dice["下"] = 7 - *dice["上"];
        *dice["南"] = 7 - *dice["北"];
      }else if(s == "south"){
        *dice["南"] = *dice["上"];
        *dice["上"] = *dice["北"];
        *dice["北"] = 7 - *dice["南"];
        *dice["下"] = 7 - *dice["上"];
      }else if(s == "east"){
        *dice["東"] = *dice["上"];
        *dice["上"] = *dice["西"];
        *dice["西"] = 7 - *dice["東"];
        *dice["下"] = 7- *dice["上"];
      }else{
        *dice["西"] = *dice["上"];
        *dice["上"] = *dice["東"];
        *dice["東"] = 7 - *dice["西"];
        *dice["下"] = 7 - *dice["上"];
      }
    }
    cout << *dice["上"] << endl;
  }
}

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

using ll = long long;

int main(){
    int N;
    cin >> N;
    vector<ll> H(N);
    for(int i = 0; i< N; i++){
        cin >> H.at(i);
    }

    for(int i=N-1; i>0;i--){
        if(H.at(i)-H.at(i-1) >=0){
            continue;
        }else if (H.at(i) - H.at(i - 1)== -1){
            H.at(i-1) -= 1;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1024
n,k = list(map(int, input().split()))
s = list(input())

if s[k-1] == "A":
    s[k-1] = "a"
elif s[k-1] == "B":
    s[k-1] = "b"
else:
    s[k-1] = "c"
print(''.join(s))


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

#define MAXN (1000010)

int n;
std::vector<int> vec[MAXN];
std::vector<int> path;
bool vis[MAXN];
std::stack<int> stack;
bool mark;
int sz[MAXN], val[MAXN];

void dfs(int u, int fa){
	stack.push(u);
	
	if(u == n){
		while(stack.top() != 1){
			path.push_back(stack.top());
			stack.pop();
		}
		path.push_back(1);
		mark = true;
		return;
	}
	for(auto v : vec[u]){
		if(v == fa) continue;
		dfs(v, u);
		if(mark) return;
	}
	stack.pop();
}

void getval(int u){
	val[u] = 1;
	vis[u] = true;
	for(auto v : vec[u]){
		if(vis[v]) continue;
		getval(v);
		val[u] += val[v];
	}
}

int main(){
	scanf("%d", &n);
	for(int i = 1; i < n; ++ i){
		int u, v;
		scanf("%d%d", &u, &v);
		vec[u].push_back(v);
		vec[v].push_back(u);
	}
	dfs(1, 0);
	std::reverse(path.begin(), path.end());
	int m = path.size(), ans1 = 0, ans2 = 0;
	
	for(auto v : path){
	    vis[v] = true;
	    //printf("v = %d\n", v);
	}
	
	for(int i = 0; i < m; ++ i){
		getval(path[i]);
	}
	
	for(int i = 0, j = m - 1; i <= j; ){
		ans1 += val[path[i ++]];
		if(i > j) break;
		ans2 += val[path[j --]];
	}
	
	//printf("ans1 = %d, ans2 = %d\n", ans1, ans2);
	
	printf(ans1 > ans2 ? "Fennec\n" : "Snuke\n");
	
	return 0;
}

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

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

int main()
{
    int n,m;cin>>n;
    m = n/2;
    
    cout<<setprecision(10)<<1.0*(n-m)/n<<endl;

   return 0;
}

Measured memory_bytes: 256
def resolve():
    '''
    code here
    '''
    N, M = [int(item) for item in input().split()]
    A_list = [int(item) for item in input().split()]

    all_sum = sum(A_list)

    if N >= all_sum:
        print(N - all_sum)
    else:
        print(-1)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9872
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;

void fin(){
	freopen("test.txt", "r", stdin);
}

int main(){
	//fin();
	while(1){
		int n, m;
		cin >> n >> m;
		if(!n) break;
		int pcnt[11] = {};
		rep(i, n){
			int d, p;
			cin >> d >> p;
			pcnt[p] += d;
		}

		for(int i = 10; i >= 1; i--){
			if(m >= pcnt[i]){
				m -= pcnt[i];
				pcnt[i] = 0;
			}else{
				pcnt[i] -= m;
				m = 0;
				break;
			}
		}

		int cnt = 0;
		rep(i, 11){
			cnt += pcnt[i]*i;
		}

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

struct RMQ {
  using type = int;
  static int id() { return 1023456789; }
  static int op(const int &l, const int &r) {
    return std::min(l, r);
  }
};

// segment tree
template <typename M>
class segment_tree {
  using T = typename M::type;
  const int n;
  vector<T> data;
  int size(int n) {
    int res;
    for (res = 1; res < n; res <<= 1);
    return res;
  }
public:
  segment_tree(int n_) : n(size(n_)), data(n * 2, M::id()) {}
  segment_tree(int n_, T val) : n(size(n_)), data(n * 2, val) {}
  void init(const vector<T>& data_) {
    for (int i = 0; i < static_cast<int>(data_.size()); i++)
      data[i + n] = data_[i];
    for (int i = n - 1; i >= 0; i--)
      data[i] = M::op(data[i * 2], data[i * 2 + 1]);
  }
  void update(int p, T val) {
    p += n;
    data[p] = val;
    while (p >>= 1) data[p] = M::op(data[p * 2], data[p * 2 + 1]);
  }
  void add(int p, T val) {
    p += n;
    data[p] += val;
    while (p >>= 1) data[p] = M::op(data[p * 2], data[p * 2 + 1]);
  }
  T find(int l, int r) {
    l += n; r += n + 1;
    T res1 = M::id(), res2 = M::id();
    while (l < r) {
      if (l & 1) res1 = M::op(res1, data[l++]);
      if (r & 1) res2 = M::op(data[--r], res2);
      l >>= 1; r >>= 1;
    }
    return M::op(res1, res2);
  }
};


int main(void)
{
  int n;
  cin >> n;
  vector<pair<int,int>> vlr(n);
  for(auto &pa:vlr) cin >> pa.first >> pa.second;
  sort(vlr.begin(),vlr.end());
  vector<int> l(n),r(n);
  REP(i,n) l[i] = vlr[i].first;
  REP(i,n) r[i] = vlr[i].second + 1;
  segment_tree<RMQ> rmq(n);
  REP(i,n) rmq.update(i,r[i]);

  int answer = 0;
  REP(i,n) {
    int tmp = r[i] - l[i];
    answer = max(answer,tmp);
    tmp += min(rmq.find(0,i-1), rmq.find(i+1,n-1));
    tmp -= l[n-1];
    answer = max(answer,tmp);
  }

  FOR(i,1,n) {
    int lseg = rmq.find(0,i-1) - l[i-1];
    int rseg = rmq.find(i,n-1) - l[n-1];
    answer = max(answer, lseg+rseg);
  }

  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>h>>w>>x>>y;
    if((h*w)%2==1&&(x+y)%2==1)Cout("No");
    else Cout("Yes");
    return 0;
}



Measured memory_bytes: 3172
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
l = [0 for _ in range(n)]
for i in range(n):
    l[i] = v[i] - c[i]
ans = 0
for i in range(n):
    if l[i] > 0:
        ans += l[i]
print(ans)

Measured memory_bytes: 3060
def solve(string):
    a, b = map(int, string.split())
    if b == 0:
        return "0"
    bin_a = "{:040b}".format(a)
    bin_b = "{:040b}".format(b)
    aa = [-1 if _a == "0" else int(bin_a[i + 1:] or "0", 2) for i, _a in enumerate(bin_a)]
    bb = [-1 if _b == "0" else int(bin_b[i + 1:] or "0", 2) for i, _b in enumerate(bin_b)]
    index = 0
    ans = []
    while index < 40:
        tmp = 0
        tmp += (bb[index] + 1) % 2 if bb[index] >= 0 else 0
        tmp += aa[index] % 2 if aa[index] > 0 else 0
        ans.append(str(tmp % 2))
        index += 1
    ans[-1] = str((b - a) // 2 % 2) if a % 2 == b % 2 == 0 else str(((b - a) // 2 + 1) % 2)
    return str(int("".join(ans), 2))


if __name__ == '__main__':
    print(solve(input()))


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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define m_p make_pair

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

    ll len = 0,ans = 0;
    string s;
    cin >> s;
    ll size = s.size();
    rep(i,size){
        if(s[i]!='A' && s[i]!='C' && s[i]!='G' && s[i]!='T'){
            len = 0;
        }else{
            len++;
        }
        ans = max(len,ans);
    }
    cout << ans << "\n";
    return 0;
}

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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)2004;
const int MOD = 924844033;

bool vis[N];

int dp[N][N][2];

int sum[N];
int fac[N];

int main(){
  fastIO;
  int n, k;
  cin >> n >> k;
  fac[0] = 1;
  for(int i = 1; i <= n; i ++ ){
    fac[i] = (fac[i - 1] * 1ll * i) % MOD;
  }
  int p;
  sum[0]=1;
  int sz = (n+k-1)/k;
  for(int i = 1; i <= n; i ++ ){
    if(vis[i]) continue;
    vis[i] = true;
    dp[i][0][0] = 1;
    if(i > k) dp[i][1][0] = 1;
    if(i + k <= n) dp[i][1][1] = 1;
    p = i;
    while(1){
      if(p + 2 * k <= n)p += 2 * k;
      else break;
      vis[p] = true;
      for(int j = 0; j <= sz; j ++ ){
        for(int q = 0 ; q < 2; q ++ ){
          dp[p][j][0] += dp[p-2*k][j][q];
          dp[p][j][0] %= MOD;
          if(q == 0){
            dp[p][j+1][0] += dp[p-2*k][j][0];
            dp[p][j+1][0] %= MOD;
          }
          if(p + k <= n){
            dp[p][j+1][1] += dp[p-2*k][j][q];
            dp[p][j+1][1] %= MOD;
          }
            
        }
      }
    } 
    for(int x = n-1; x >= 0; x -- ){
      for(int y = sz ; y >= 1; y -- ){
        if(x+y <= n)sum[x+y] = (sum[x+y] + sum[x] * 1ll * (dp[p][y][0] + dp[p][y][1])%MOD)%MOD;
      }
    }
  }
  int ans = 0;
  for(int i = 0 ; i <= n; i ++ ){
    if(i % 2 == 0){
      ans += (sum[i] * 1ll * fac[n-i]) % MOD;
      ans %= MOD;
    }
    else{
      ans -= (sum[i] * 1ll * fac[n-i]) % MOD;
      ans %= MOD;
      if(ans < 0) ans += MOD;
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

int main() {
    int n;
    cin >> n;
    vector<long long> a(87);
    for(int i = 0; i < 87; i++){
        a[0] = 2;
        a[1] = 1;
        if (i > 1){
            a[i] = a[i - 1] + a[i - 2];
        }
    }
    cout << a[n] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(void){
    int n,p; cin>>n>>p;
    vector <int> a(n);
    bool odd=false;
    int ans = 1;
    for(int i=0;i<n;i++){
        cin>>a[i];
        ans*=2;
        if(a[i]%2==1) odd = true;
    }
    if(odd == false){
        if(p==0) cout<<ans<<endl;
        else cout<<0<<endl;
        return 0;
    }
    else{
        cout<<ans/2<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int N;
  string S;
  cin>>N>>S;
  rep(i,S.size()){
    cout<<char('A'+(S[i]-'A'+N)%26);
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <ios>
#include <iomanip>
#include <stack>
#include <queue>
#include <algorithm>

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

using namespace std;

const int INF = 100000000;

int main(){
  long long x,y;

  cin >> x >> y;

  long count = 1;
  long long num = x;
  while (true) {
    num = num * 2;
    if (num > y) {
      break;
    }
    count++;
  }

  cout << count << endl;
  return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<functional>
#include<map>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;
int main(){
    double ans = 0;
    int N;
    cin >> N;
    vector<int> times(N+2), velocitys(N+2), safe(N+2), sumtimes(N+2);
    times[0]=velocitys[0]=sumtimes[0]=0;
    times.back()=velocitys.back()=0;
    REPA(i, N+1){
        cin>>times[i];
    }
    REPA(i, N+1){
        cin >> velocitys[i];
    }
    ++N;
    REPA(i, N+1){
        sumtimes[i]=sumtimes[i-1]+times[i];
        safe[i]=sumtimes[i-1]+velocitys[i];
    }
    double nowtime=0;
    double nowspeed=0;
    while(nowtime<sumtimes.back()){
        double ns = nowspeed+0.5;
        REPA(i, N+1){
            if(sumtimes[i-1] > nowtime && safe[i] < nowtime+0.5+ns){
                ns-=0.5;
                break;
            }
            if(sumtimes[i-1]<=nowtime&&nowtime<sumtimes[i]){
                if(ns > velocitys[i]){
                    ns-=0.5;
                    break;
                }
            }
        }
        REPA(i, N+1){
            if(sumtimes[i-1] > nowtime && safe[i] < nowtime+0.5+ns){
                ns-=0.5;
                break;
            }
            if(sumtimes[i-1]<=nowtime&&nowtime<sumtimes[i]){
                if(ns > velocitys[i]){
                    ns-=0.5;
                    break;
                }
            }
        }
        ans+=(ns+nowspeed)*0.25;
        nowtime+=0.5;
        nowspeed=ns;
    }
    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

var color map[int]int

func getScore(score int) int {
	if score >= 3200 {
		return 0
	} else {
		return int(score/400) + 1
	}
}

var N int

func main() {
	color = make(map[int]int)
	fmt.Scan(&N)
	tmp := 0
	for i := 0; i < N; i++ {
		fmt.Scan(&tmp)
		color[getScore(tmp)] += 1
	}

	num := 0
	for c, _ := range color {
		if c != 0 {
			num += 1
		}
	}

	max := 0
	min := 0
	if num == 0 {
		min = 1
	} else {
		min = num
	}

	/*
		if num+color[0] >= 8 {
			max = 8
		} else {
			max = num + color[0]
		}
	*/

	max = num + color[0]
	fmt.Println(min, max)
}


Measured memory_bytes: 512
fun main() {
    val MAX=2501
    val (n,a)= readLine()!!.split(" ").map { it.toInt() }
    val x= readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    var dp=Array(n+1){Array(n+1){LongArray(MAX){0} } }
    dp[0][0][0]=1
    for (i in 0 until n){
        for (j in 0 until n){
            for (k in 0 until MAX){
                dp[i+1][j][k]+=dp[i][j][k]
            }
        }
        for (j in 0 until n){
            for (k in 0 until MAX-x[i]){
                dp[i+1][j+1][k+x[i]]+=dp[i][j][k]
            }
        }
    }
    var ans=0L
    for (i in 1..n){
        ans+=dp[n][i][i*a]
    }
    println(ans)
}

Measured memory_bytes: 102324
#include<iostream>
using namespace std;
int main()
{
    int n,g=0,w=0,p=0,y=0;
    cin>>n;

    char a;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a=='G')
            g=1;
        else if(a=='W')
            w=1;
        else if(a=='P')
            p=1;
        else if(a=='Y')
            y=1;
    }
    int c=g+w+p+y;
    if(c==3)
    cout<<"Three"<<endl;
    else
        cout<<"Four"<<endl;

    return 0;

}


Measured memory_bytes: 256
K_List = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(K_List[int(input())-1])


Measured memory_bytes: 2940