akhauriyash/Code-Regression huggingface dataset:
N , M = map(int,input().split())

# 電球
k = []
s = []


for i in range(M):
    I = input().split()

    k.append(I.pop(0))
    s.append(list(map(int,I)))


P = list(map(int , input().split()))
status = [0]*N

count = 0

for i in range(2**N):
    flag = True

    binary = i
    for j in range(N):
        status[j] = 1 if (binary % 2 == 1) else 0
        binary = int(binary / 2)

    for j in range(M):
        sum = 0
        for index in s[j]:
            sum = sum + status[index-1]

        if sum % 2 != P[j]:
            flag = False
            break

    if flag:
        count = count + 1


print(count)

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

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  cin >> h >> w;
  int cnt = 0;
  for (int i = 0; i < h * w; i++) {
    char c;
    cin >> c;
    if (c == '#') cnt++;
  }
  if (cnt == h + w - 1) {
    cout << "Possible" << '\n';
  } else {
    cout << "Impossible" << '\n';
  }
  return 0;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
//#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

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;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
signed main(){
    int N,K;
    scanf("%lld",&N);
    scanf("%lld",&K);
    Vi A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    Vi F(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&F[i]);
    }

    sort(ALL(A));
    sort(ALL(F),greater<int>());

    int sum=0;
    REP(i,0,N) sum+=A[i];
    if(sum<=K) {cout<<0<<endl;return 0;}

    int low=0,high=INF;
    while(high-low>1){
        int x=(low+high)/2; //xは感触するのにかかる秒数
        int training=0;
        REP(i,0,N){
            int power=x/F[i];
            int needtrain=max(0LL,A[i]-power);
            training += needtrain;
        }
        if(training<=K) high=x;
        else low=x;
    }
    int ans=high;
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3328
import copy
import itertools
import numpy as np

H, W, K = map(int, input().split())
c = []
for _ in range(H):
    c.append(list(input()))
ans = 0

list_H = []
for i in range(1, H+1):
    list_H.append(i)
list_W = []
for i in range(1, W+1):
    list_W.append(i)

for i in range(H+1):
    for v in itertools.combinations(list_H, i):
        tmp_masu = []
        for j in list(v):
            tmp_masu.append(c[j-1])
        tmp_masu = np.array(tmp_masu)
        for j in range(W+1):
            for x in itertools.combinations(list_W, j):
                try:
                    tmp_masu_ = copy.deepcopy(tmp_masu)
                    count = 0
                    for k in list(x):
                        tmp_masu_ = np.delete(tmp_masu_, k-1-count, 1)
                        count += 1
                    tmp = tmp_masu_.tolist()
                    count_ = 0
                    for k in range(len(tmp)):
                        count_ += tmp[k].count('#')
                    if count_ == K:
                        ans += 1
                except IndexError:
                    pass
print(ans)


Measured memory_bytes: 27148
package main

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func maxInt64(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumInt64(a []int64) int64 {
	var ret int64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

// sort ------------------------------------------------------------

type int64Array []int64

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

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

func dfs(idx int, d int64) {
	if d%2 == 0 {
		color[idx-1] = 0
	} else {
		color[idx-1] = 1
	}
	for next, w := range tree[idx] {
		if color[next-1] != -1 {
			continue
		}
		dfs(next, d+w)
	}
}

var tree map[int]map[int]int64
var color []int

func main() {
	n := readInt()
	tree = make(map[int]map[int]int64)
	for i := 0; i < n-1; i++ {
		u := readInt()
		v := readInt()
		w := readInt64()
		if _, ok := tree[u]; !ok {
			tree[u] = make(map[int]int64)
		}
		if _, ok := tree[v]; !ok {
			tree[v] = make(map[int]int64)
		}
		tree[u][v] = w
		tree[v][u] = w
	}
	color = make([]int, n)
	for i := range color {
		color[i] = -1
	}

	dfs(1, 0)

	for i := range color {
		fmt.Println(color[i])
	}
}


Measured memory_bytes: 39936
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(int i=0;i<n;i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
int main(){
 IOS
    int n,k;
    cin>>n>>k;
    vector<int> power(n);
    fo(i,n) cin>>power[i];
    sort(all(power));
    reverse(all(power));
    ll ans=0;
    if(k>=n) {cout<<0<<endl; return 0;}
    FOR(i,k,n-1) ans=ans+power[i];

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
// make pair, tuple
// __gcd(int, int)
// 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;
// }
// int countSubString(string s, string temp){
//       int ans = 0;
//       size_t f = s.find(temp);
//       while(f != string::npos){
//             ans++;
//             f = s.find(temp, f + 1);
//       }
//       return ans;
// }

int main(){
    int n;cin >> n;
    map<int,int> m;
    for(int i = 0;i < n;i++){
        int t;cin >> t;
        m[t]++;
        if(m[t] == 2)return cout << "NO", 0;
    }
    cout << "YES";
}

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

using namespace std;
int main() {
    string a;
    while(1) {
        cin >> a;
        if (a =="0") break;
        int sum = 0;
        int b;
        for (int j=0; j<a.size(); j++) {
            
            b= a[j]-'0';
            sum += b;
            }
        cout << sum << endl;
        }
    
    }



Measured memory_bytes: 3132
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,a,b,c,d,xsum=0,ysum=0;
	cin>>n>>a>>b>>c>>d;
	if(n%a==0)
		xsum=n/a*b;
	else
		xsum=(n/a+1)*b;
	if(n%c==0)
		ysum=n/c*d;
	else
		ysum=(n/c+1)*d;
	if(xsum<ysum)
		cout<<xsum<<endl;
	else
		cout<<ysum<<endl;
	return 0;
}


Measured memory_bytes: 3096
/**
 * Author : dhakad_123
 * Created: 11.07.2020
 **/

#include<bits/stdc++.h>
using namespace std;


bool check(int i , int n){

	int n1 = i+1;

	if(n1 % 2 != 0 && n % 2 != 0){
		return true;
	}
	return false;
}

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

	int n; 
	cin >> n;

	int nums[n];

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


	int ans = 0;


	for(int i = 0; i < n; i++){

		if(check(i , nums[i])){
			ans++;
		}

	}
	cout << ans << " \n";

	

	return 0;

}



Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#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;

int main(int argc, char const *argv[]) {
  ll a, b;std::cin >> a >> b;
  if(a+b>=10) std::cout << "error" << '\n';
  else std::cout << a+b << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,x;
    cin>>n>>x;
    int cur=0,cnt=0;
    while(n--)
    {
        int a;
        cin>>a;
        if(cur<=x)
            cnt++;
        cur+=a;
    }
 if(cur<=x)
            cnt++;
            cout<<cnt<<endl;
    return 0;
}


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

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

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

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n; i++){
    if(n%i==0){
      res.push_back(i);
    if(i!=n/i)res.push_back(n/i);
    }
  }
  return res;
}

int main(){
  ll n, cn; cin>>n;
  cn=n;

  int result1=0;
  auto nums = divisor(n);
  for(auto t: nums){
    if(t==1)continue;

    ll ccn = n;
    while(ccn%t==0 && ccn>=t)ccn/=t;
    if(ccn%t==1)result1++;
  }

  n--;
  map<ll, ll> m;
  for(ll i=2; i*i<=n; i++){
    while(n%i==0){
      m[i]++;
      n /= i;
    }
  }
  if(n>1)m[n]++;

  int result=1;
  for(auto p:m){
    result*=(p.second+1);
  }
  result--; // 1

  cout<<result+result1<<endl;
  
  return 0;
  
  cout<<result<<' '<<result1<<endl;


  for(auto t: nums)cout<<t<<' ';cout<<endl;
  cout<<endl;
  for(auto p: m)cout<<p.first<<' '<<p.second<<endl;

  return 0;
}


Measured memory_bytes: 3716
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] sArr = s.split("");

        List<Integer> countList = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            int prev = i;
            int count = 0;
            for (int j = 0; j < sArr.length; j++) {
                int current = Integer.parseInt(sArr[j]);
                if (prev == 0) {
                    if (current == 0) {
                        count++;
                    }
                    prev = 1;
                } else if (prev == 1) {
                    if (current == 1) {
                        count++;
                    }
                    prev = 0;
                }
            }
            countList.add(count);
        }
        System.out.println(Collections.min(countList));
    }

}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

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

const int MAXN = 1e5 + 5;

int cnt[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	int a;
	REP(i, 0,n){
		scanf("%d", &a);
		cnt[a]++;
	}
	int ans = 0;
	REP(i, 0, MAXN - 1){
		int tmp = cnt[i - 1] + cnt[i] + cnt[i + 1];
		if (tmp > ans){
			ans = tmp;
		}
	}
	printf("%d\n", ans);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

string s;

int powMod(int n, int p) {
  int res = 1;
  while (p) {
    if (p & 1) (res *= n) %= MOD;
    (n *= n) %= MOD;
    p >>= 1;
  }
  return res;
}
int invMod(int n) {
  return powMod(n, MOD - 2);
}

int solve(int i, int less){
  if(i == s.size()) return 1;

  if(less) return powMod(3, s.size()-i);
  if(s[i] == '0') return solve(i+1, false)%MOD;
  return (2*solve(i+1, false)+solve(i+1, true))%MOD;
}

signed main() {
  cin >> s;

  cout << solve(0, false)%MOD << endl;

  return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <sstream>
#include <vector>

std::vector<int> split()
{
	std::vector<int> res;
	std::string line;
	std::getline(std::cin, line, '\n');

	std::string item;

	for (int n = 0; n < line.size(); ++n)
	{
		if (line.at(n) == ' ')
		{
			if (!item.empty())
				res.push_back(std::stoi(item));

			item.clear();
		}

		else
		{
			item += line.at(n);
		}
	}

	if (!item.empty())
		res.push_back(std::stoi(item));

	return res;
}

int main()
{
	int r, c;
	auto a = split();
	r = a[0];
	c = a[1];

	std::vector<std::vector<int> > vec;

	for (int y = 0; y < r; ++y)
	{
		auto nw = split();

		int sum = 0;

		for (const auto& e : nw)
			sum += e;

		nw.push_back(sum);

		vec.push_back(nw);
	}


	int* counter = new int[c + 1];
	for (int x = 0; x <= c; ++x)
	{
		counter[x] = 0;
	}

	for (int y = 0; y < r; ++y)
	{
		for (int x = 0; x <= c; ++x)
		{
			std::cout << vec[y][x];
			counter[x] += vec[y][x];

			if (x == c)
				std::cout << std::endl;
			else
				std::cout << " ";
		}
	}

	for (int x = 0; x <= c; ++x)
	{
		std::cout << counter[x];

		if (x == c)
			std::cout << std::endl;
		else
			std::cout << " ";
	}

	delete[] counter;

	return 0;
}


Measured memory_bytes: 3188
N,W = map(int,input().split())
Value = []
weight = []
inf=float("inf")
dp=[[-inf for i in range(W+1)] for j in range(N+1)]
for i in range(W+1): dp[0][i]=0

for i in range(N):
    w,v = map(int,input().split())
    Value.append(v)
    weight.append(w)


for i in range(N):
  for w in range(W+1):
    if w>=weight[i]:
      dp[i+1][w] = max(dp[i][w-weight[i]]+Value[i],dp[i][w])
    else:
      dp[i+1][w] = dp[i][w]

print(dp[N][W])

Measured memory_bytes: 311732
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
used = [0] * N
cost_list = []

def dfs(depth):
    if depth == N:
        a, b, c = 0, 0, 0
        flag_a, flag_b, flag_c  = False, False, False
        cost = 0
        for i in range(N):
            if used[i] == 0:
                if flag_a:
                    cost += 10
                a += l[i]
                flag_a = True
            elif used[i] == 1:
                if flag_b:
                    cost += 10
                b += l[i]
                flag_b = True
            elif used[i] == 2:
                if flag_c:
                    cost += 10
                c += l[i]
                flag_c = True
            else:
                pass
        if min(a, b, c) > 0:
            cost += abs(a - A) + abs(b - B) + abs(c - C)
            return cost
        else:
            return 10**9

    for i in range(4):
        used[depth] = i
        cost_list.append(dfs(depth + 1))

    return 10**9

dfs(0)

print(min(cost_list))


Measured memory_bytes: 5316
n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]

p = 10**9 +7
ans = [0]*(n+1)
ans[0] = 1
ans[1] = 1

broken = [0]*(n+1)
for i in a:
    broken[i]= -1

for i in range(1,n):
    if broken[i] == -1:
        ans[i] = 0
        ans[i+1] = ans[i-1]%p
    else:
        ans[i+1] = (ans[i-1] + ans[i])%p

print(ans[-1])

Measured memory_bytes: 81360
N,T=list(map(int,input().split()))
v=[]
for z in range(N):
  c,t=list(map(int,input().split()))
  v.append((c,t))

min_cost=99999
for z in v:
  if z[1]<=T and min_cost>z[0]:
    min_cost=z[0]

if min_cost==99999:
  print("TLE")
else:
  print(min_cost)

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

using namespace std;

#define rep(i , n)  for(int i=0 ; i<n ; i++)
#define rep1(i , n) for(int i=1 ; i<=n ; i++)
#define FAST        ios_base :: sync_with_stdio(false); cin.tie(NULL);
typedef long long int ll;


int main()
{
	FAST;

	int b[100];
	int a[100];
	int n,m,c;
	cin >> n >> m >> c;

	rep(i , m)
		cin >> b[i];
		
	int count = 0;
	while(n--)
	{
		int temp;
		int ans = 0;
		rep(i , m)
		{
			cin >> temp;
			ans += b[i]*temp;
		}
		ans += c;
		if(ans > 0)
				count++;
	}
	cout << count;
	return 0;
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var A = int.Parse(ss[0]);
            var B = int.Parse(ss[1]);
            var C = int.Parse(ss[2]);

            Console.WriteLine(A <= C && C <= B ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 11092
/******************************************
* AUTHOR : SOMU KUMAR *
* INSTITUTION : IIT BHUBANESWAR *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
ll di(ll x,ll y){
	return x*x+y*y;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//code here...............//
ll n,d;
cin>>n>>d;
ll x,y;
int cnt=0;
for(int i=0;i<n;i++){
	cin>>x;
	cin>>y;
	ll dist=di(x,y);
	if((d*d)>=dist)cnt++;
}
cout<<cnt<<endl;
return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
long solve(vector<long>& arr,vector<vector<long>>& dp,int s,int e){
    // if(s>e){
    //     return INT_MAX;
    // }
    if(s==e){
        return 0;
    }
    if(s+1==e){
        return arr[s]+arr[e];
    }
    if(dp[s][e]!=-1){
        return dp[s][e];
    }
    
    dp[s][e] = 10000000000000000;
    long sum = 0;
    for(int i=s;i<e;i++){
        dp[s][e] = min(dp[s][e],solve(arr,dp,s,i)+solve(arr,dp,i+1,e));
        sum+=arr[i];
    }
    return dp[s][e] = dp[s][e]+sum+arr[e];
}
int main() {
	int n;
	cin>>n;
	vector<long> arr(n);
	for(int i=0;i<n;i++){
	    cin>>arr[i];
	}
	vector<vector<long>> dp(n+1,vector<long>(n+1,-1));
	cout<<solve(arr,dp,0,n-1)<<'\n';
	return 0;
}


Measured memory_bytes: 1536
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ESecondSum {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        vector<int> pos(N + 1);
        REP(i, N) {
            int n;
            cin >> n;
            pos[n] = i + 1;
        }
        int res = 0;
        set<int> s;
        s.insert(0);
        s.insert(N + 1);
        REV(n, N, 1) {
            int p = pos[n];
            if (n != N) {
                {
                    auto itr = s.upper_bound(p);
                    if (itr != s.end()) {
                        int rr = *itr;
                        itr++;
                        int r = itr != s.end() ? *itr : N + 1;

                        itr = s.upper_bound(p);
                        itr--;
                        int l = *itr;
                        res += (r - rr) * (p - l) * n;
                    }
                }
                {
                    auto itr = s.upper_bound(p);
                    itr--;
                    if (itr != s.begin()) {
                        int ll = *itr;
                        itr--;
                        int l = *itr;

                        itr = s.upper_bound(p);
                        int r = *itr;
                        res += (r - p) * (ll - l) * n;
                    }
                }
            }
            s.insert(p);
        }
        cout << res << endl;

    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ESecondSum solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 5760
#include <iostream>

using namespace std;
using ll = long long;

int main() {
  ll n, m;
  cin >> n >> m;
  if (m < n)
    swap(n, m);
  if (n == 1) {
    if (m == 1)
      cout << 1 << endl;
    else
      cout << m - 2 << endl;
  }
  else {
    cout << (n - 2) * (m - 2) << endl;
  }
}


Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=200001 ;
int main()
{
   fast ;
   ll n,m,sum=0 ;
   cin>>n>>m ;
   vector<ll>v(n) ;
   for(ll i=0;i<n;i++)
   { cin>>v[i] ;
     sum+=v[i] ;
   }
   sort(all(v)) ;
   ll ans=0 ;
   for(ll i=0;i<n;i++)
   {
       ll x=sum/(4*m) ;
       if(sum%(4*m)!=0)
       {
           x++ ;
       }
       if(v[i]>=x)
       {
           ans++ ;
       }
   }
   if(ans>=m)cout<<"Yes"<<endl ;
   else cout<<"No" ;



}



Measured memory_bytes: 256
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int t = 0;
		for (char ch : sc.next().toCharArray()) if (ch=='1') t++;
		System.out.println(t);
		sc.close();		
	}

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

}

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

using namespace std;
using ll = long long;

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

    vector<bool> pattern(1000, false);

    for(int i = 0;i < 1000; i++) {
        int a = 0,b = 0;
        for(a = 0; a < N; a++) {
            if(i / 100 == S[a] - '0') {
                break;
            }
        }

        for(b = a + 1; b < N; b++) {
            if((i / 10) % 10 == S[b] - '0') {
                break;
            }
        }

        for(int c = b + 1; c < N; c++) {
            if(i % 10 == S[c] - '0') {
                pattern[i] = true;
                break;
            }
        }
    }

    auto res = count_if(pattern.begin(), pattern.end(), [](auto a){return a;});
    cout << res << endl;
}

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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

// 文字から数値に変換
int getChar(char ch) {
    if (ch=='A') return 1;
    else if(ch=='C') return 2;
    else if(ch=='G') return 3;
    else if(ch=='T') return 4;
    else return 0;
}

// 文字列から数値へ変換してkeyを生成する
long long getKey(char str[]) {
    long long sum=0, p=1, i;
    for (i=0; i<strlen(str); i++) {
        sum += p*getChar(str[i]);
        p *= 5;
    }
    return sum;
}

int h1(int key) { return key % M; }
int h2(int key) { return 1 + (key%(M-1)); }

int find(char str[]) {
    long long key, i, h;
    key = getKey(str);
    for (i=0; ; i++) {
        h = (h1(key) + i+h2(key)) % M;
        if( strcmp(H[h], str) == 0) return 1;
        else if( strlen(H[h]) == 0) return 0;
    }
    return 0;
}

int insert(char str[]) {
    long long key, i, h;
    key = getKey(str);
    for (i=0; ; i++) {
        h = (h1(key) + i+h2(key)) % M;
        if( strcmp(H[h], str) == 0) return 1;
        else if( strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main() {
    int i, n, h;
    char str[L], com[9];
    for (i=0; i<M; i++) H[i][0] = '\0';
    scanf("%d", &n);
    for(i=0; i<n; i++) {
        scanf("%s %s", com, str);
        
        if(com[0] == 'i') {
            insert(str);
        } else {
            if(find(str)) {
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
    return 0;
}


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

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

    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
}

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

static const int N_MAX = 1e5;
static const int C_MAX = 30;
int nx[C_MAX][N_MAX];
vector<vector<int>> idx(C_MAX);

int main(){
    string s, t;
    cin >> s >> t;
    int n = s.size();
    for(int i = 0; i < n; i++){
        idx[s[i]-'a'].push_back(i);
    }
    for(int i = 0; i < C_MAX; i++){
        for(int j = 0; j < n; j++){
            if(idx[i].empty()) continue;
            nx[i][j] = idx[i][0] + n;
            for(auto k : idx[i]){
                if(j < k){
                    nx[i][j] = k;
                    break;
                }
            }
        }
    }
    if(idx[t[0]-'a'].empty()){
        cout << -1 << endl;
        return 0;
    }
    ll ans = idx[t[0]-'a'][0];
    for(int i = 1; i < t.size(); i++){
        if(idx[t[i]-'a'].empty()){
            cout << -1 << endl;
            return 0;
        }
        ans += nx[t[i]-'a'][ans % n] - (ans % n);
    }
    cout << ans + 1 << endl;
    return 0;
}

Measured memory_bytes: 14280
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**6)

def operation(s,f):
    c = 0
    for i in range(len(s)):
        if (s[i] == f and i % 2 == 1) or (s[i] != f and i % 2 == 0):
            c += 1
    return c

def solve(s):
    return min(operation(s,"0"),operation(s,"1"))

def main():
    S = input()
    print(solve(S))


if __name__ == '__main__':
    main()

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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    //連結成分の個数 = ノードの数 - 辺の個数
    //ノードの数は簡単に計算できるので, 辺の個数を求める
    //辺の個数は(L, R)を含む時 L*(N-R+1)
    int n; cin >> n;
    ll V = 0;
    rep(i,n) V += (i+1)*(n-i);
    ll E = 0;
    rep(i,n-1){
        ll u,v; cin >> u >> v;
        if(u > v)swap(u,v);
        //それらがカウントされる個数
        E += u*(n-v+1);
    }
    out(V-E);
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

const int MAX_N = 41;

class node {
  public:
    int p = -1;
    int l = -1;
    int r = -1;
};
node nod[MAX_N];

vector<int> preorder(MAX_N);
vector<int> inorder(MAX_N);
vector<int> postorder(0);

void setpostorder(int now) {
    if(nod[now].l != -1) setpostorder(nod[now].l);
    if(nod[now].r != -1) setpostorder(nod[now].r);
    postorder.push_back(now);
}

int recon(int left, int right, int size) {
    if(left == right)
        return inorder[left];
    else if(left > right)
        return -1;
    else {
        rep(i, 1, size + 1) {
            rep(j, left, right + 1) {
                if(preorder[i] == inorder[j]) {
                    nod[preorder[i]].l = recon(left, j - 1, size);
                    nod[preorder[i]].r = recon(j + 1, right, size);
                    return preorder[i];
                }
            }
        }
    }
    return -2;
}

int main() {
    int n, id, l, r, root;
    cin >> n;
    rep(i, 1, n + 1) cin >> preorder[i];
    rep(i, 1, n + 1) cin >> inorder[i];

    root = recon(1, n, n);

    setpostorder(root);
    vecout(postorder);
}



Measured memory_bytes: 3168
import std.stdio, std.conv, std.string;
import std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

int DEBUG_LEVEL = 0;
void print()(){ writeln(""); }
void print(T, A ...)(T t, lazy A a){ write(t), print(a); }
void print(int level, T, A ...)(T t, lazy A a){ if(level <= DEBUG_LEVEL) print(t, a); }

void main(string[] args){
	if(args.length > 1 && args[1] == "-debug"){
		if(args.length > 2 && args[2].isNumeric) DEBUG_LEVEL = args[2].to!int;
		else DEBUG_LEVEL = 1;
	}
	
	int n = read.to!int;
	
	Node[] nodes;
	foreach(i; 0 .. n) nodes ~= new Node(i);
	
	Edge[] edges;
	foreach(i; 0 .. n - 1){
		int u = read.to!int - 1;
		int v = read.to!int - 1;
		long w = read.to!long;
		edges ~= new Edge(nodes[u], nodes[v], w);
	}
	
	nodes[0].setValue(1);
	foreach(ed; edges) ed.paint();
	
	foreach(nd; nodes) nd.value.writeln;
	
}

class Edge{
	Node node1;
	Node node2;
	long value;
	this(Node node1, Node node2, long value){
		if(node1.id < node2.id) this.node1 = node1, this.node2 = node2;
		else this.node1 = node2, this.node2 = node1;
		node1.edges ~= this, node2.edges ~= this;
		this.value = value;
	}
	void paint(){
		if(node1.isVisited && ! node2.isVisited){
			node2.setValue((node1.value + this.value) % 2);
			foreach(ed; node2.edges) ed.paint();
		}
		else if(! node1.isVisited && node2.isVisited){
			node1.setValue((node2.value + this.value) % 2);
			foreach(ed; node1.edges) ed.paint();
		}
		else if(! node1.isVisited && node2.isVisited){
			foreach(ed; node1.edges) ed.paint();
			foreach(ed; node2.edges) ed.paint();
		}
		
	}
}

// 木 辺の重み edge 再帰

class Node{
	int id;
	int value = -1;
	bool isVisited = 0;
	Edge[] edges;
	this(int id){
		this.id = id;
	}
	void setValue(int v){
		value = v % 2;
		this.isVisited = 1;
	}
}


Measured memory_bytes: 27388
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 998244353
#define eps 1e-13
// #define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pll a, pll b)//true for a before b
{
	if(a.F*b.S < b.F*a.S)
		return 1;
	if(a.F*b.S > b.F*a.S)
		return 0;
	if(a.F <= b.F)
		return 1;
	return 0;
}

const int N = (2e5) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 900;
const int SQRT = BUCK+9;

int a[N];

void solve()
{
	int n, i, val;
	ll ans = 0;
	cin >> n;
	fo(i,1,n+1)
		cin >> a[i];

	fo(i,1,n+1)
		if(a[i] > i-1)
		{
			cout << -1 << '\n';
			return;
		}
	
	val = 0;
	for(i = n; i > 0; i--)
	{
		val = max(val-1, 0);
		if(a[i] < val)
		{
			cout << -1 << '\n';
			return;
		}
		if(a[i] > val)
		{
			ans += a[i];
			val = a[i];
		}
	}
	cout << ans << '\n';
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	// io_file;
	// srand (time(NULL));

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(9);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

Measured memory_bytes: 1024
import java.util.*

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val ln = readLine()!!.split(" ").map(String::toInt).sorted()

    var sum = 0
    for (ai in 0 until ln.size - 2) {
        for (bi in ai + 1 until ln.size - 1) {
            val ab = ln[ai] + ln[bi]
            sum += ln.binarySearch(ab, Comparator { x, y -> if (x >= y) 1 else -1 }).inv() - (bi + 1)
        }
    }
    println(sum)
}



Measured memory_bytes: 48492
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <float.h>
#include <stdlib.h>
#include <functional>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define in cin >>
#define out cout <<
#define sort(v) sort(v.begin(),v.end())
#define reverse(v) reverse(v.begin(),v.end())
#define all(v) v.begin(),v.end()
typedef long long ll;
ll modpow(ll a,ll n,ll mod){
    ll res=1;
    while(n>0){
        if(n&1)res=a*res%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}
void comb(vector<vector <long long int> > &v){
  for(int i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(int k = 1;k <v.size();k++){
    for(int j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}
 
 
int main(){
    int n;
    cin >> n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(i%5==0||i%3==0){
        }else
        {
            ans=ans+i;
        }
        
 
    }
    cout << ans;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int N, M, X;
int C[13], A[13][13];

int main() {
    cin >> N >> M >> X;
    for (int i = 1; i <= N; i++) {
        cin >> C[i];
        for (int j = 1; j <= M; j++) {
            cin >> A[i][j];
        }
    }
    int ans = (int)1e9;
    for (int i = 1; i < (1 << N); i++) {
        int cost = 0, v[13] = {0};
        for (int j = 1; j <= N; j++) {
            if ((1 << (j - 1)) & i) {
                cost += C[j];
                for (int k = 1; k <= M; k++) {
                    v[k] += A[j][k];
                }
            }
        }
        int flag = true;
        for (int j = 1; j <= M; j++) {
            if (v[j] < X)
                flag = false;
        }
        if (flag)
            ans = min(ans, cost);
    }
    cout << (ans == (int)1e9 ? -1 : ans) << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
 
string s,t; int N,ans;
 
int main(){

  cin>>N;

  cin>>s>>t; int j=N-1;

  for(int i=N-1; i>=0; i--){

    if(t[i]!=s[j]) ans++;
    else j--;
  
  }

  cout<<ans+N<<endl;
  
  return 0;
  
 
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    string s;
    cin >> s;
    if(N & 1)return 0 & puts("No");
    for(unsigned long i = 0; 2 * i < N; ++i)if(s[i] != s[i + N / 2])return 0 & puts("No");
    puts("Yes");
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int[] A = new int[N + 2];
		A[0] = 0;
		A[N + 1] = 0;
		
		for(int i = 1; i <= N; i++) {
			A[i] = sc.nextInt();
		}
		
		int[] d = new int[N + 2];
		int D = 0;
		
		for(int i = 1; i <= N + 1; i++) {
			d[i] = A[i] - A[i - 1];
			D += Math.abs(d[i]);
		}
		
		int money = 0;
		
		for(int i = 1; i <= N; i++) {
			money = D - Math.abs(d[i]) - Math.abs(d[i + 1]) + Math.abs(d[i] + d[i + 1]);
			System.out.println(money);
		}
		
	}
}


Measured memory_bytes: 63604
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 21:12:07 2019

@author: yff20
"""

l1 = input().split()

ln = [0] * (int(l1[1]))

for num in range(0, int(l1[0])):
   l2 = input().split()
   for index in range(1, len(l2)):
       ln[int(l2[int(index)])-1] += 1
    
count = 0

for i in ln:
    if(i==int(l1[0])):
        count += 1

print(count)


Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1000000007;

// ref: https://github.com/atcoder-live/library/blob/master/mint.cpp
struct mint
{
  ll x;
  mint(ll x = 0) : x((x % MOD + MOD) % MOD)
  {
  }
  mint operator-() const
  {
    return mint(-x);
  }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += MOD - a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const
  {
    return mint(*this) += a;
  }
  mint operator-(const mint a) const
  {
    return mint(*this) -= a;
  }
  mint operator*(const mint a) const
  {
    return mint(*this) *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const
  {
    return pow(MOD - 2);
  }
  mint &operator/=(const mint a)
  {
    return *this *= a.inv();
  }
  mint operator/(const mint a) const
  {
    return mint(*this) /= a;
  }
};
istream &operator>>(istream &is, const mint &a)
{
  return is >> a.x;
}
ostream &operator<<(ostream &os, const mint &a)
{
  return os << a.x;
}

struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
      fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
      ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
      return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main()
{
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  vector<mint> arr(N + 1);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &A[i]);
    arr[i + 1] = arr[i] + A[i];
  }
  mint ans = 0;
  for (int i = 0; i < N; ++i)
  {
    ans += mint(A[i]) * (arr[N] - arr[i + 1]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6428
#include <bits/stdc++.h>
#include <boost/dynamic_bitset.hpp>

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_S = 200005;
int N;
string S;
int dp[MAX_S][3][3][2]; //合計mod, 直前の文字種, 連続フラグ

unordered_set<string> SET;

void solve(string S) {
    SET.insert(S);
    REP(n,N-1) {
        if(S[n] != S[n+1]) {
            int k = 0;
            while(k == S[n]-'a' || k == S[n+1]-'a') {
                k++; k%=3;
            }
            string tmpS = S;
            tmpS[n] = tmpS[n+1] = 'a'+k;
            if(SET.find(tmpS) == SET.end()) {
                solve(tmpS);
            }
        }
    }
}

signed main()
{
    cin >> S;
    N = S.size();

    bool flag = true;
    bool pFlag = false;
    int K = S[0] - 'a';
    FOR(i,1,N) {
        if(S[0] != S[i]) {
            flag = false;
        }
        if(S[i] == S[i-1]) {
            pFlag = true;
        }
        K += S[i] - 'a';
    }
    K %= 3;

    if(flag) {
        cout << 1 << endl;
        return 0;
    }

    if(N <= 3) {
        solve(S);
        cout << SET.size() << endl;
        return 0;
    }

    dp[0][0][0][0] = 1;
    REP(n,N) {
        REP(j,3) {
            REP(k,3) {
                REP(l,2) {
                    REP(kk,3) {
                        bool nextFlag = (l | k==kk);
                        if(n == 0) {
                            nextFlag = false;
                        }
                        dp[n+1][(j+kk)%3][kk][nextFlag] += dp[n][j][k][l];
                        dp[n+1][(j+kk)%3][kk][nextFlag] %= MOD9;
                    }
                }
            }
        }
    }
    
    cout << (dp[N][K][0][1] + dp[N][K][1][1] + dp[N][K][2][1] + (pFlag == true ? 0 : 1)) % MOD9 << endl;

    return 0;
}

Measured memory_bytes: 28676
#include <bits/stdc++.h>
#define HAIRETU(N,A) for(int i=0;i<N;i++) cin >>A[i]
using namespace std;

int main(){
    int N,L;
    string st[110],moji="";
    cin >> N >> L;
    HAIRETU(N, st);
    sort(st, st+N);
    
    for (int i = 0; i < N; i++) {
        moji += st[i];
    }
    
    
    cout << moji << endl;
    return 0;
}



Measured memory_bytes: 256