akhauriyash/Code-Regression huggingface dataset:
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
# import numpy as np
# import scipy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]
 
 
def main():
    h, w = map(int, input().split())
    s = [list(input()) for _ in range(h)]
    
    ans = 0
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    for i in range(h):
        for j in range(w):
            if s[i][j] == '#': continue
    
            q = []
            q.append([i, j])
            dist = [[-1 for _ in range(w+5)] for _ in range(h + 5)]
            dist[i][j] = 0
            M = 0
            while q:
                x, y = q[0]
                q.pop(0)
                for p in range(4):
                    nx, ny = x + dx[p], y + dy[p]
                    if 0 <= nx < h and 0 <= ny < w:
                        if dist[nx][ny]==-1 and s[nx][ny] == '.':
                            q.append([nx, ny])
                            dist[nx][ny] = dist[x][y] + 1
                            if M<dist[nx][ny]:
                                M = dist[nx][ny]
            ans = max(ans,M)
    print(ans)
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 46188
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

bool alive[1005];

int main()
{
//	cut here before submit 
//	freopen ("testcase.josephs_potato", "r", stdin );
	memset (alive, false, sizeof (alive ) );
	int n, m;
	while (scanf ("%d %d", &n, &m ),n ){
		fill (alive, alive + n, true );
		int curr = 0, cnt;
		while ((int)count (alive, alive + n, true ) > 1 ){
			cnt = 1;
			while (cnt < m ){
				while (!alive[curr] ){
					curr = (curr+1)%n;
				}// end while
				cnt++;
				curr = (curr+1)%n;
			} // end while
			while (!alive[curr] ){
				curr = (curr+1)%n;
			} // end while
//			cout << setw(2) << curr << " is dead." << endl;
			alive[curr] = false;
			while (!alive[curr] ){
				curr = (curr+1)%n;
			} // end while
//			cout << setw(2) << curr << " is next start person." << endl;
		} // end while
		cout << curr+1 << endl;
	} // end while	

	return 0;
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int ggcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,k,ans=1000000000;
  cin>>n>>k;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  sort(v.begin(),v.end());
  rep(i,n-k+1){
    ans=min(v[i+k-1]-v[i],ans);
  }
  cout<<ans<<endl;
}
///////////////////////////

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 
using pl = pair<ll,ll>;

signed main(){
	ll n,m; cin>>n>>m;
	vvl v(n,vl(0));
	vector<pl> vp(m);
	rep(i,0,m){
		ll a,b; cin>>a>>b;
		//cout<<a<<endl;
		vp[i]=make_pair(a,b);
		--a;
		v[a].push_back(b);
	}
	rep(i,0,n)if(v[i].size()>0)sort(all(v[i]));
	rep(i,0,m){
		//cout<<'a';
		ll a,b; tie(a,b)=vp[i];
		ll j=1;
		rep(k,0,v[a-1].size()){
			//cout<<v[a-1][k];
			if(v[a-1][k]==b){
				j=k+1;
				break;
			}
		}
//		cout<<endl;
		string s=to_string(a);
		rep(i,0,6-s.size())cout<<0;
		cout<<a;
		string t=to_string(j);
		rep(i,0,6-t.size())cout<<0;
		cout<<j<<endl;
	}
		
	
	
	
	return 0;
}

Measured memory_bytes: 10212
s = input()
w = int(input())
n = len(s)
ans = []
now = 0
while now<n:
  ans.append(s[now])
  now += w
for i in range(len(ans)):
  if i != len(ans)-1:
    print(ans[i],end='')
  else:
    print(ans[i])

Measured memory_bytes: 3188
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
using namespace std;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

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

    string ans;
    for(int i=0;i<S.size();){
        ans += S.substr(i, 1);
        i += w;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
//Serene
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<set>
using namespace std;
#define ll long long
#define db double
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
const int maxn=1e5+7;
int n,f[maxn];

char cc;ll ff;
template<typename T>void read(T& aa) {
	aa=0;ff=1; cc=getchar();
	while(cc!='-'&&(cc<'0'||cc>'9')) cc=getchar();
	if(cc=='-') ff=-1,cc=getchar();
	while(cc>='0'&&cc<='9') aa=aa*10+cc-'0',cc=getchar();
	aa*=ff;
}

int find(int x) {return x==f[x]? x:f[x]=find(f[x]);}

set<int> G[maxn],H[maxn];
set<int>::iterator it;

struct Node{
	int x,y;
	Node(){}
	Node(int x,int y):x(x),y(y){}
}zz[maxn];
int s=1,t=0;

void get_inz(int x,int y) {
	if(x>y) swap(x,y);
	G[x].erase(y); G[y].erase(x);
	H[x].erase(y); H[y].erase(x);
	zz[++t]=Node(x,y);
}

bool solve() {
	int x,y,z;
	while(s<=t) {
		x=zz[s].x; y=zz[s].y; s++; x=find(x); y=find(y);
		if(G[x].size()+H[x].size()<G[y].size()+H[y].size()) swap(x,y);
		for(it=G[y].begin();it!=G[y].end();++it) {
			z=*it; G[z].erase(y); G[z].insert(x);
			G[x].insert(z);
			if(H[x].find(z)!=H[x].end()) get_inz(x,z);
		}
		for(it=H[y].begin();it!=H[y].end();++it) {
			z=*it; H[z].erase(y); H[z].insert(x);
			H[x].insert(z);
			if(G[x].find(z)!=G[x].end()) get_inz(x,z);
		}
		f[y]=x;
	}
	return t==n-1;
}

int main() {
	read(n); int x,y;
	For(i,1,n) f[i]=i;
	For(i,1,n-1) {
		read(x); read(y);
		G[x].insert(y); G[y].insert(x);
	}
	For(i,1,n-1) {
		read(x); read(y);
		H[x].insert(y); H[y].insert(x);
		if(G[x].find(y)!=G[x].end()) get_inz(x,y);
	}
	if(solve()) printf("YES\n");
	else printf("NO\n");
	return 0;
}


Measured memory_bytes: 29824
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}
int32_t main()
{
	int a,b,n;
	cin >> a >> b >> n;
	if(n<b)
	{
		cout << (a*n)/b;
		return 0;
	}
	else if(n==b)
	{
		cout << (a*(n-1))/b;
	}
	else
	{
		cout << (a*(b-1))/b;
	}
	
	
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 1e5;
const int inf = 1e9+9;
#define ll long long
ll w[N+9], val[N+9], mem[109][N+9];

ll dp(int i, int j) {
	if(j<0) return -inf;
	if(i<=0 || j==0) return 0;
	if(mem[i][j] != -1) return mem[i][j];
	return mem[i][j] = max(dp(i-1, j), dp(i-1, j-w[i])+val[i]);
}
int main(){
	ios_base::sync_with_stdio(0);
	int a,b,n,W,T,cas=0;
	cin>>n>>W;
	for(int i=1;i<=n;++i) {
		cin>>w[i]>>val[i];
	}
	memset(mem, -1, sizeof(mem));
	cout<<dp(n, W)<<endl;
	return 0;
}

Measured memory_bytes: 86272
#! usr/bin/perl

use strict;
use warnings;

my %cards;
my $result = 0;

sub add_cards{
  my $weight = $_[0];
  chomp(my $N = <STDIN>);
  foreach (0..$N-1)
  {
    chomp (my $card = <STDIN>);
    $weight == 1 ? ++$cards{$card} : --$cards{$card};
  }
}
&add_cards(1);
&add_cards(0);

foreach my $card(keys %cards){
  if ($cards{$card}>$result) {$result = $cards{$card}}};

print "$result\n";


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello
{
    public static void Main()
    {
        //入力を保持する
        var N = int.Parse(Console.ReadLine());
        var As = Console.ReadLine().Split().Select(e => int.Parse(e)).OrderBy(e => e).ToArray();
        //As配列内に1が1つ存在している場合は1以外は1によりすべて割り切れるため1が回答となる
        if ((As.Count(e => e == 1) == 1))
        {
            Console.WriteLine("1");
            return;
        }
        //1が1よりも多く存在している場合、1も1で割り切れるため0が回答となる
        if ((As.Count(e => e == 1) > 1))
        {
            Console.WriteLine("0");
            return;
        }

        var max = (int)1e6;

        //As配列に含まれる数字の数をカウントするためNがとりうる最大の数分配列を準備する
        var cnt = new int[max+10];
        for (var num = 0; num < N; num++)
        {
            cnt[As[num]]++;
        }
        //Asに含まれる数字の倍数すべてをbool型で保持する
        //-->割り切れないというのは言い換えればAiがその他の数の倍数にならないということ
        var baisuFlgs = new bool[max + 1];
        foreach (var i in As.Distinct())
        {
            var temp = i;
            while(temp + i <= max)
            {
                temp += i;
                baisuFlgs[temp] = true;
            }

        }

        //cnt配列内にAiの数が1であり、かつbaisuFlags配列内にAiの倍数のインデックスがFalseであればカントアップしていく
        var ans = 0;
        for (var i= 0;i < N;i++)
        {
            if (baisuFlgs[As[i]] == false && cnt[As[i]] == 1)
            {
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
}


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

int main() {
  int n;

  while (cin >> n, n) {
    vector<int64_t> a(n);
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }

    int64_t sum = accumulate(a.begin(), a.end(), 0ll);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      if (a[i] * n <= sum) ans++;
    }

    cout << ans << endl;
  }
}



Measured memory_bytes: 3128
#include<stdio.h>
#include<math.h>
int main()
{
 int kosuu, Num, counter = 0, i, j, zyougen;
  
 scanf("%d", &kosuu);
  
 for(i = 1;i <= kosuu;i++){
   scanf("%d",&Num);
   zyougen=sqrt(Num);
   if (Num >= 3) {
     for(j = 2;j <= (zyougen + 1);j++){
       if ((Num % j) == 0) {
         counter++;
         break;
       }
     } 
    }
    if (Num == 1) {
      counter++;
    }
 }
 printf("%d\n",kosuu - counter);
 return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

typedef struct _node {
  int id;
  struct _node *parent;
  struct _node *child;
  struct _node *sibling;
} Node;

typedef Node* NodePointer;

int main () {
  NodePointer NodeArray;
  int n;
  
  scanf("%d", &n);
  NodeArray = (NodePointer)malloc(sizeof(Node)*n);

  for (int i = 0; i < n; i++) {
    NodeArray[i].id = i;
    NodeArray[i].parent  = NULL;
    NodeArray[i].child   = NULL;
    NodeArray[i].sibling = NULL;
  }
  
  for (int i = 0; i < n; i++) {
    int id, k;
    scanf("%d %d", &id, &k);

    int c, s;
    for (int j = 0; j < k; j++) {
      scanf("%d", &c);

      if (j == 0) {
	NodeArray[id].child = &NodeArray[c];
      } else {
	NodeArray[s].sibling = &NodeArray[c];
      }
      NodeArray[c].parent = &NodeArray[id];

      s = c;
    }
  }

  for (int i = 0; i < n; i++) {
    printf("node %d: ", NodeArray[i].id);
    printf("parent = %d, ", NodeArray[i].parent == NULL ? -1 : NodeArray[i].parent->id);
    int d = 0;
    NodePointer tmp = &NodeArray[i];
    while (tmp->parent != NULL) {
      d++;
      tmp = tmp->parent;
    }
    printf("depth = %d, ", d);
    printf("%s, ", NodeArray[i].parent == NULL ? "root" : NodeArray[i].child == NULL ? "leaf" : "internal node");
    printf("[");
    if (NodeArray[i].child != NULL) {
      printf("%d", NodeArray[i].child->id);
      tmp = NodeArray[i].child->sibling;
      while (tmp != NULL) {
	printf(", %d", tmp->id);
	tmp = tmp->sibling;
      }
    }
    printf("]\n");
  }
  
  free(NodeArray);
  
  return 0;
}



Measured memory_bytes: 4672
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    def c(n):
        if n == 1:
            return 0
        else:
            return n * (n - 1) // 2


    N = int(lines.pop(0))
    NLIST = {}
    for i in range(N):
        l = ''.join(sorted(lines.pop(0)))
        if l in NLIST:
            NLIST[l] += 1
        else:
            NLIST[l] = 1

    re = 0
    for n in NLIST.values():
        re += c(n)
    print(re)
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 20352
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <string>
#include <cstring>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <memory>

//#pragma comment(linker, "/STACK:16777216")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,abm,mmx,avx,avx2,popcnt,tune=native")

using namespace std;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define ll long long
#define ull unsigned long long
//#define double long double
//#define int ll
//#define int ull
//#define int short
//#define int unsigned short
//#define int unsigned int
#define mp make_pair
#define F first
#define S second
#define pii pair<int, int>
#define pdd pair<double, double>
#define pid pair<int, double>
#define pdi pair<double, int>
#define hash hash228
const int SZ = 2e5 + 4;
const double EPS = 1e-7;
const int mod = 1e9 + 7;
const int hashpow = 2;
const int inf = 2e9;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int x;

inline void read() {
    cin >> x;
}

inline void solve() {
    int d = x * 360 / __gcd(x, 360);
    cout << d / x << "\n";
}

signed main() {

#ifdef __LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

//    int t;
//    cin >> t;
//    for (int i = 0; i < t; ++i) {
    read();
    solve();
//    }

    return 0;
}

Measured memory_bytes: 3692
x,n = map(int, input().split())
p = sorted(list(map(int, input().split())))

ans = 0
if (x not in p):
    ans = x
else:
    for i in range(1, n):
        if (x - i not in p):
            ans = x - i
            break
        elif (x + i not in p):
            ans = x + i
            break
print(ans)


Measured memory_bytes: 9124
#include<stdio.h>
#include<string.h>

void swap(char *a, char *b)
{
	char t;
	t = *a;
	*a = *b;
	*b = t;
	return;
}

char all[40322][9];
int count;
void permute(char a[], int start, int end)
{
	if(start == end)
	{
		strcpy(all[count++], a);
		return;
	}
	int i,j;
	char t;
	for(i=start; i<=end; i++)
	{
		t = a[i];
		for(j=i;j-1>=start;j--)
			swap(a+(j-1), a+j);
		a[j]=t;
		permute(a, start+1, end);
		t = a[start];
		for(j=start;j+1<=i; j++)
			swap(a+(j+1), a+j);
		a[j]=t;
	}
	return;
}
int main()
{
	char str1[9], str2[9];
	int i,n,b,t1;
	while(~scanf("%d", &n))
	{
		char a[]="123456789";
		a[n]=0;
		for(i=0; i<n; i++)
		{
			scanf("%d", &b);
			str1[i]=b+48;
		}
		str1[i]=0;
		for(i=0; i<n; i++)
		{
			scanf("%d", &b);
			str2[i]=b+48;
		}
		str2[i]=0;
		count = 0;
		permute(a, 0, n-1);
		for(i=0; i<count; i++)
		{
			if((strcmp(all[i], str2)==0)||(strcmp(all[i], str1)==0))
			{
				t1=i;
				if(strcmp(all[i], str2)==0)
				{
					for(; i<count; i++)
					{
						if(strcmp(all[i], str1)==0)
						{
							printf("%d\n", i-t1);
							i=count;
						}
					}
				}
				else
				{
					for(; i<count; i++)
					{
						if(strcmp(all[i], str2)==0)
						{
							printf("%d\n", i-t1);
							i=count;
						}
					}
				}
			}
		}
	}	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
	int N, SN;
	cin >> N;
	int n = N;
	SN = 0;
	while (n != 0){
		SN += n % 10;
		n /= 10;
	}

	if (N % SN == 0){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

ll P = 1000000007;
ll n, x, y, z;
ll mask = (1<<18) - 1;
vvl dp = VV(41, (1<<18), 0, ll);
vector<int> mem(1<<18, -1);

int judge(ll state){
  if(mem[state]!=-1) return mem[state]==1;
  vll dat(3, 0);
  ll cnt = 0;
  for(int i=0;i<19;i++){
    dat[cnt]++;
    if((state>>i)&1){
      if(cnt==0&&dat[0]==x) cnt++;
      if(cnt==1&&dat[1]==y) cnt++;
      if(cnt==2&&dat[2]==z){
        return mem[state] = 1;
      }
    }
  }
  return mem[state] = 0;
}
int main(int argc, char const *argv[]) {
  std::cin >> n >> x >> y >> z;
  ll ans = 0;
  dp[0][0] = 1;
  vll t(50, 1);
  for(int i=1;i<50;i++) t[i]=(t[i-1]*10)%P;
  for(int i=0;i<n;i++){
    for(int j=0;j<(1<<18);j++){
      for(int num=1;num<=10;num++){
        ll nx = ((j<<num)|(1<<(num-1)))&mask;
        if(judge(nx)){
          ans = (ans + (dp[i][j]*t[n-1-i])%P)%P;
        }else{
          dp[i+1][nx] = (dp[i+1][nx] + dp[i][j])%P;
        }
      }
    }
  }
  // O(20 * 2^18 + 40 * 10 * 2^18)
  // だいたい O(1.1*10^8)
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 87420
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int a;
    cin >>a;
    int b[a];
    int n=0;
    long d;
    while(n<a){
        
        cin >> b[n];
        d+=b[n];
        n+=1;
    }
    sort(b,b+a);
    
    cout << b[0] << " "<< b[a-1] << " "<< d<< endl;
    
}


Measured memory_bytes: 3168
#include<stdio.h>
int main(void)
{
	int n,t,i,k,h,x,w;
	w=0;
	while(1){
	scanf("%d",&n);
	if(n==0) break;
	scanf("%d",&t);
	for(i=0;i<t;i++){
		scanf("%d %d",&k,&h);
		w+=h-k;
		}
	if(n<=w){
		printf("OK\n");
		}
	else{
		x=n-w;
		printf("%d\n",x);
		}
	w=0;	
	}
		return 0;
}

Measured memory_bytes: 1040
import sys

while True:
    try:
	a,b = map(int,raw_input().split())
	tempa = a
	tempb = b
	while tempa % tempb != 0 :
	    tempa , tempb = (tempb,tempa%tempb)
	gcd = tempb
	lcm = a * b / gcd
	print "%d %d" % ( gcd, lcm)
	

    except EOFError:
	break

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

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

const LL mod = 1000000007;

int main()
{
    int N, M;
    cin >> N >> M;

    if (N>M) swap(N, M);

    vector<LL> P(M+1);
    P[0] = P[1] = 1;
    FOR(i, 2, M+1) P[i] = (P[i-1]*i)%mod;

    if (M-N>1) cout << 0 << endl;
    else if (M==N) cout << (P[N]*P[M]*2)%mod << endl;
    else cout << (P[N]*P[M])%mod << endl;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	string s;
	cin >> s;
	bool b=true;
	bool c=true;
	bool d=true;
	ll n=SIZE(s);
	rep(i,n/2){
		if(s[i]!=s[n-1-i]) b=false;
	}
	rep(i,n/4){
		if(s[i]!=s[n/2-1-i]) c=false;
	}
	rep(i,n/4){
		if(s[n/2+1+i]!=s[n-1-i]) d=false;
	}
	if(b&&c&&d) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	int n,min=999999999,sum=0,x,i,m;
	cin>>n>>x;
	for(i=1; i<=n; i++)
	{
		cin>>m;
		if(m<min) min=m;
		x-=m;
		sum++;
	}
	sum+=x/min;
	cout<<sum;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>

using namespace std;  //このネームスペースを使う

int main(){
	int N;
	cin >> N;
	float A[N];
    float sum;
    int i;

    for(i=0;i<N;i++){
      cin >> A[i];
    }

    sum=0;
    for(i=0;i<N;i++){
      sum = sum + 1/A[i];
    }

	cout << fixed << setprecision(5) << 1/sum << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
#define mod 1000000007
ll t,n,m,i,j,k,l,arr[sz],brr[sz],crr[sz];
vector<ll>v;
int main()
{
    scanf("%lld",&t);
    for(i=1;i<=t;i++)
    {
        scanf("%lld",&l);
        if(l%2==1 && i%2==1)
            m++;
    }
    printf("%lld\n",m);
    return 0;
}



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



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

	string S;
	map<string, int>count;
	
	rep(0, N) {
		static int j = 0;

		cin >> S;
		count[S] += 1;

	}
	int y = 0;
	for (auto& x : count) {
		if (y < x.second) {
			y = x.second;
		}
	}

	

	for (auto& x : count) {
		if (y == x.second) {
			cout << x.first << endl;
		}
	}
}


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

int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,i;
    cin>>n;
    for(i=1;i<=9;i++)
    {
    	if(n%i==0)
    	{
    		if((n/i)<=9&&n/i>=1)
    		{
    			cout<<"Yes\n";
    			return 0;
			}
		}
	}
    cout<<"No\n";
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    long sum = 0;
    
    for(int i = 1; i <= N; i++){
      if(i%3 == 0)
        continue;
      if(i%5 == 0)
        continue;
      sum += i;
    }
    System.out.println(sum);
  }
}

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

constexpr int INF = 1000000001;
vector<int> lis(vector<int> ary) {
    vector<int> dp(ary.size(), INF);
    for (const auto& x : ary) {
        *upper_bound(dp.begin(), dp.end(), x) = x;
    }
    return vector<int>(dp.begin(), lower_bound(dp.begin(), dp.end(), INF));
}

int main()
{
  int N; cin >> N;
  vector<int> A(N, 0);
  for (int i = 0; i < N; i++) { cin >> A[i]; A[i] *= -1; }
  cout << lis(A).size() << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

vector<pair<int,int>> v;
ll dx=1,dy=1;
ll k;

void solve(ll x,ll y){
    if(x==0&&y==0)return;
    if((x+y)%k==0){
        v.push_back(make_pair(dx*x,dy*y));
        ll p=min(x,k);
        x-=p;
        y-=(k-p);
        solve(x,y);
    }
    else if(x+y<k&&(x+y)%2){
        v.push_back(make_pair(dx*x,dy*y));
        ll p=(k-x+y)/2;
        x+=(k-p);
        y-=p;
        v.push_back(make_pair(dx*x,dy*y));
        y-=p;
        x-=(k-p);
        v.push_back(make_pair(dx*x,dy*y));
        return;
    }
    else if(x>2*k){
        v.push_back(make_pair(dx*x,dy*y));
        solve(x-k,y);
    }
    else if(y>2*k){
        v.push_back(make_pair(dx*x,dy*y));
        solve(x,y-k);
    }
    else{
        ll n;
        ll c=(k-(x+y)%k+k)%k;
        if(x+y<k){
            n=2;
        }
        else if(c%2){
            n=(x+y+k-1)/k+1;
        }
        else{
            n=(x+y+k-1)/k;
        }
        ll i=(k*n-x-y)/2;
        ll q=y+i;
        while(q){
            v.push_back(make_pair(dx*x,dy*y));
            ll p=min(q,k);
            q-=p;
            y-=p;
            x-=(k-p);
        }
        while(x){
            v.push_back(make_pair(dx*x,dy*y));
            ll p=min(x,k);
            x-=p;
        }
        return;
    }
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> k;
    ll x,y; cin >> x >> y;
    if(k%2==0&&(x+y)%2){
        printf("-1\n");
        return 0;
    }
    bool change=(abs(y)>abs(x));
    if(change)swap(x,y);
    if(x<0)dx=-1,x=-x;
    if(y<0)dy=-1,y=-y;
    solve(x,y);
    if(change){
        for(int i=0;i<v.size();i++){
            swap(v[i].first,v[i].second);
        }
    }
    reverse(v.begin(), v.end());
    printf("%d\n",v.size());
    for(int i=0;i<v.size();i++){
        printf("%d %d\n",v[i].first,v[i].second);
    }
}

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

string s;
string ACGT = "ACGT";

int main() {
    cin >> s;
    int n = s.size();

    int ans = 0;
    int cnt = 0;
    for(int i = 0; i < n; i++) {
        if(ACGT.find(s[i]) != -1)  cnt++;
        else                       cnt = 0;
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

constexpr lli inf = 10000 * 10000;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	int n, r;
	cin >> n >> r;

	cout << r + (100 * max(0, 10 - n)) << endl;


	return 0;
}


Measured memory_bytes: 256
//I read the news today, oh boy
//About a lucky man who made the grade
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ll((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
#define roF(i,a,b) for(ll i = ll(a); i >= ll(b); i--)
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const ll N=3e3+100;
const ll INF=1e18;

int w, h;
ll area[N][N];
ll ans;

int movx[4] = {0,1,0,-1};
int movy[4] = {1,0,-1,0};
bool block[N][N][4];
bool vis[N][N];

void check(int i, int j){
	if(i<0 || i>=h || j<0 || j>=w){
		cout<<"INF"<<endl;
		exit(0);
	}
}

void bfs(int i, int j){
	queue<ii> Q;
	Q.push(mp(i,j));
	check(i,j);
	vis[i][j]=1;
	while(!Q.empty()){
		i = Q.front().ff;
		j = Q.front().ss;
		Q.pop();
		ans += area[i][j];
		For(k,0,4) if(!block[i][j][k]){
			int nxti = i + movy[k];
			int nxtj = j + movx[k];
			check(nxti,nxtj);
			if(!vis[nxti][nxtj]){
				vis[nxti][nxtj]=1;
				Q.push(mp(nxti,nxtj));
			}
		}
	}
}

vector<pair<ii, ll> > vert, hor;
vi coordx, coordy;
unordered_map<ll,ll> idx, idy;

int main(){
	fastio;
	int n, m; cin>>n>>m;		
	For(i,0,n){
		ll d, u, x; cin>>d>>u>>x;
		vert.pb(mp(mp(d,u),x));
		coordx.pb(x);		
		coordy.pb(d);
		coordy.pb(u);
	}	
	For(i,0,m){
		ll y, l, r; cin>>y>>l>>r;
		hor.pb(mp(mp(l,r),y));
		coordy.pb(y);
		coordx.pb(l);
		coordx.pb(r);
	}
	coordx.pb(0);
	coordy.pb(0);

	sort(all(coordx));
	coordx.resize(unique(all(coordx))-coordx.begin());
	w = sz(coordx);
	For(i,0,w) idx[coordx[i]]=i;

	sort(all(coordy));
	coordy.resize(unique(all(coordy))-coordy.begin());
	h = sz(coordy);
	For(i,0,h) idy[coordy[i]]=i;
       if(w>=N || h>=N){
              cout<<"xd"<<endl;
       }
	w--, h--;
	For(i,0,h)
		For(j,0,w)
			area[i][j] = (coordy[i+1]-coordy[i])*(coordx[j+1]-coordx[j]);
	for(auto l: vert){
		int d = l.ff.ff, u = l.ff.ss, x = l.ss;
		int izq = idx[x]-1, der = idx[x];
		int i = idy[d];
		int fin = idy[u];
		while(i<fin){
			if(izq>=0) block[i][izq][1]=1; 
			if(der<w) block[i][der][3]=1;
			i++;
		}
	}
	for(auto elem: hor){
		int l = elem.ff.ff, r = elem.ff.ss, y = elem.ss;
		int down = idy[y]-1, up = idy[y];
		int j = idx[l];
		int fin = idx[r];
		while(j<fin){
			if(down>=0) block[down][j][0]=1; 
			if(up<h) block[up][j][2]=1;
			j++;
		}
	}
	bfs(idy[0],idx[0]);
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 119564
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;
    static long N, M;

    static void input()
    {
        cin = new Scanner();

        N = cin.nextLong();
        M = cin.nextLong();
    }
    static void solve()
    {
        input();
        long ans = 0;
        if(M <= N * 2)
        {
            ans += M / 2;
        }
        else
        {
            ans += N;
            M -= 2 * N;
            ans += M / 4;
        }
        WriteLine(ans);
    }
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }
        
        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

        public double[] ArrayDounble(int N, int add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string s;
    cin>>n>>s;
    vector<int> e(n+1,0);
    vector<int> w(n+1,0);
    int ans=300000;
    for(int i=0;i<n;i++){
        w[i+1]=w[i];
        if(s[i]=='W')w[i+1]++;
    }
    for(int i=n;i>=1;i--){
        e[i-1]=e[i];
        if(s[i]=='E')e[i-1]++;
    }
    for(int i=0;i<=n;i++){
        //cout<<w[i]<<" "<<e[i]<<endl;
        ans=min(ans,w[i]+e[i]);
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  
  if (B-A+1 > 2*K){
    for (int i = A; i < A+K; i++) cout << i << endl;
    for (int i = B-K+1; i <= B; i++) cout << i << endl;
  }
  else {
    for (int i = A; i <= B; i++) cout << i << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n,m,flg[501],list[10000][2],cnt,i;
	while(1){
		cin>>n>>m;
		if(n==0) break;
		for(i=1;i<=n;i++) flg[i]=0;
		for(i=0;i<m;i++){
			cin>>list[i][0]>>list[i][1];
			if(list[i][0]==1) flg[list[i][1]]=1;
		}
		for(i=0;i<m;i++){
			if(flg[list[i][0]]==1&&flg[list[i][1]]==0) flg[list[i][1]]=2;
			if(flg[list[i][1]]==1&&flg[list[i][0]]==0) flg[list[i][0]]=2;
		}
		cnt=0;
		for(i=2;i<=n;i++){
			if(flg[i]!=0) cnt++;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 3132
while true
    n = gets.to_i
    break if n == 0
    n.times{
        m, e, j = gets.chomp.split.map(&:to_i)
        grade = "C"
        if [m, e, j].include?(100) || (m + e) >= 180 || (ave = m + e + j) >= 240
            grade = "A"
        elsif ave >= 210 || (ave >= 150 && (m >= 80 || e >= 80))
            grade = "B"
        end
        puts grade
    }
end


Measured memory_bytes: 6856
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N, K;
  cin >> N >> K;
  vector<int64_t> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec[i];
  }
  int64_t ok = 1e9;
  int64_t ng = 0;
  while(ok - ng > 1){
    int64_t mid = (ok+ng)/2;
    int64_t cnt = 0;
    for(int i=0; i<N; i++){
      cnt += ((vec[i] + mid-1) / mid) - 1;
    }
    if(cnt <= K){
      ok = mid;
    }
    else{
      ng = mid;
    }
  }
  cout << ok << endl;
}



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

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

int main(){
  string s;cin>>s;
  int n=(int)s.size();
  int ans=n-1;
  for(int i=0;i<26;i++){
  	int start=-1, suc=0;
    int max_suc=0, fi=-1;
    for(int j=n-1;j>=-1;j--){
      if(j==-1 || s[j]==char('a'+i)){
      	if(start!=-1){
          max_suc = max(max_suc, start-j-1);
          suc=0;
          start=j;
        }else{
          start=j;
          if(fi==-1)fi=j;
        }
      }
    }
    max_suc=max(max_suc, n-fi-1);
    // cout<<char('a'+i)<<" "<<max_suc<<endl;
    if(fi!=-1)ans=min(ans, max_suc);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
can = []
for i in range(n):
  now = a[i]
  try:
    if now == can[-1][0]:
      can[-1][1] += 1
    else:
      can.append([now,1])
  except:
    #i==0
    can.append([now,1])
    #print('zozo')
can.sort(key= lambda x:x[1])
l = len(can)
ans = 0
if l-k > 0:
  for j in range(l-k):
    ans += can[j][1]
  print(ans)
else:
  print(0)

Measured memory_bytes: 32964
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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












int main() {
	ll n;
	cin >> n;
	vector<vector<pair<ll, ll>>> v(n);
	REP(i, n) {
		ll a;
		cin >> a;
		REP(j, a) {
			ll x, y;
			cin >> x >> y;
			x--;
			v[i].push_back({ x, y });
		}
	}
	ll ans = 0;
	REP(bit, (1 << n)) {
		[&]() {
			REP(i, n) {
				if (!(bit & (1 << i))) continue;
				REP(j, v[i].size()) {
					if (v[i][j].second ^ ((bit & (1 << v[i][j].first)) ? 1 : 0)) return;
				}
			}
			ans = max(ans, [bit]() {
				ll c = 0, b = bit;
				while (b) {
					if (b & 1) c++;
					b >>= 1;
				}
				return c;
			}());
		}();
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	W := nextInt()
	H := nextInt()
	x := nextInt()
  y := nextInt()
  r := nextInt()
	if 0 <=(x - r)&& W >= (x+r) {
    if 0 <=(y - r)&& H >= (y+r)  {
    fmt.Println("Yes")
    }else{
    fmt.Println("No")
    }
  }else{
    fmt.Println("No")
  }

}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}



Measured memory_bytes: 1112
#include <iostream>

using namespace std;

bool search(const unsigned long long* array, const int size, const unsigned long long val);

int main() {
	int n, q, count;
	unsigned long long *S;
	unsigned long long T;

	count = 0;
	cin >> n;
	S = new unsigned long long[n];
	for(int i = 0; i < n; i++) {
		cin >> S[i];
	}
	cin >> q;
	for(int i = 0; i < q; i++) {
		cin >> T;
		if(search(S, n, T)){
			count++;
		}
	}

	cout << count << endl;

	delete[] S;

	return 0;
}

bool search(const unsigned long long* array, const int size, const unsigned long long val) {
	for(int i = 0; i < size; i++) {
		if(val == array[i]) {
			return true;
		}
	}
	return false;
}


Measured memory_bytes: 3172
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
int main() 
{
	int x, h;
	double S;
	while (1) {
		cin >> x;
		cin >> h;
		if (x == 0 && h == 0) {
			break;
		}
		S = x * x + 4 * 0.5 * x * sqrt(x * 0.5 * x * 0.5 + h * h);
		cout << fixed << setprecision(6) << S << endl;
	}
	return 0;
}


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>


int main() {
	int a, b, c; std::cin >> a >> b >> c;
	std::cout << (a + b + c) - std::max({ a, b, c }) << std::endl;
}

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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
void dfs(string s,char pre){
	if(s.length()==n)cout<<s<<endl;
	else for(char i=97;i<=pre;i++)dfs(s+i,pre+(i==pre));
}
int main(){
	cin>>n;
	dfs("",97);
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n,k;
    cin >> n >> k;
    double d = 0;
    for( int i = 1; i <= n; ++i ) {
        int t = i;
        double c = 1;
        while( t < k ) {
            t *= 2;
            c *= 0.5;

        }
        d += c * (double(1) / n);

    }
    printf("%.10lf\n", d);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <bitset>
#include <list>
#include <cmath>
using namespace std;

int main() {
	long n;
	cin >> n;
	long tmp = 0;
	for (long i = 1; i <= n; ++i) {
		tmp = i;
		if (i * (i + 1) / 2 >= n) {
			break;
		}
	}
	long sa = tmp * (tmp + 1) / 2 - n;
	for (long i = 1; i <= tmp; ++i) {
		if (i != sa) {
			cout << i << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int k,a,b;
	int c = 0;
	scanf("%d",&k);
	scanf("%d %d",&a,&b);
	for ( int i = a; i <= b; i++)
	{
		if ( i % k == 0)
		{
			c = 1;
		}
	}
	
	if (c == 1)
	{
		printf("OK\n");
	} else {
		printf("NG\n");
	}
	
	return 0;
}

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

#define int long long
//typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif



signed main() {
    int N;
    cin >> N;
    vector<int> c(N-1),s(N-1),f(N-1);
    rep(i,N-1){
        cin >> c[i] >> s[i] >> f[i];
    }
    rep(i,N-1){
        int ans=0;
        
        for(int k=i; k<N-1;k++){
            int d = max(0LL,(ans-s[k]+f[k]-1)/f[k]);
            ans = s[k]+f[k]*d+c[k];
//            dump(i,k,d,ans);
        }
        
        cout << ans << endl;
    }
    cout << 0 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)
string pading(string a){
	string rtn = a;
	while(rtn.size()<6)rtn = '0'+rtn;
	return rtn;
}

string convert(lli a,lli b){
	string A = to_string(a);
	string B = to_string(b);
	return pading(A)+pading(B);
}

signed main(){

	lli n,m;
	cin>>n>>m;

	map<pair<lli,lli>,string> ans;
	vector<set<lli>> v(n);
	vector<lli> p(m),y(m);

	REP(i,0,m){
		if(DEBUG)cout<<"ohuton"<<endl;
		cin>>p[i]>>y[i];
		p[i]--;
		v[p[i]].insert(y[i]);
	}

	if(DEBUG)cout<<"ohuton"<<endl;

	REP(i,0,n){
		if(DEBUG)cout<<"i="<<i<<endl;
		lli cnt=1;
		for(auto e:v[i]){
			if(DEBUG)cout<<"e= "<<e<<endl;
			ans[mp(i,e)]=convert(i+1,cnt);
			cnt++;
		}
	}

	REP(i,0,m){
		cout<<ans[mp(p[i],y[i])]<<endl;
	}




	return 0;
}

Measured memory_bytes: 23424