akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
int main(){
    ll N,K;
    cin>>N>>K;
    VL A(N+1,0);
    ll d;
    ll ans=0;
    rep(i,0,K){
        cin>>d;
        rep(j,0,d){
            int a;
            cin>>a;
            A[a]+=1;
        }
    }
    rep(i,1,N+1){
        if(A.at(i)==0)ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
const int MAXN = 405;
const ll MOD = 998244353;
ll fac[MAXN], invfac[MAXN];
ll inv[MAXN];
ll binom(ll a, ll b) {
	if (b < 0) return 0;
	if (b > a) return 0;
	return (((fac[a] * invfac[b]) % MOD) * invfac[a - b]) % MOD;
}
ll modex(ll a, ll p, ll m = MOD) {
	if (!p) return 1;
	if (p & 1) return a * modex(a, p - 1, m) % m;
	ll v = modex(a, p >> 1, m);
	return v * v % m;
}
int main() {
	fac[0] = 1;
	for (int i = 1; i < MAXN; ++i)
		fac[i] = fac[i - 1] * i % MOD;
	invfac[MAXN - 1] = modex(fac[MAXN - 1], MOD - 2);
	for (int i = MAXN - 2; i >= 0; --i)
		invfac[i] = invfac[i + 1] * (i + 1) % MOD;
	for (int i = 1; i < MAXN; ++i)
		inv[i] = invfac[i] * fac[i - 1] % MOD;
	int n;
	scanf("%d", &n);
	vector<ll> A(n), B(n);
	int sa = 0, sb = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%lld%lld", &A[i], &B[i]);
	}
	vector<vector<ll>> dp(405, vector<ll>(405)), ndp;
	dp[0][0] = 1;
	for (int i = 0; i < n; ++i) {
		ndp = dp;
		for (int a = 0; a <= sa; ++a) {
			for (int b = 0; b <= sb; ++b) {
				ll pw = 1;
				for (int j = 0; j < B[i]; ++j) {
					ndp[a + A[i]][b + j] -= dp[a][b] * pw % MOD * invfac[j];
					ndp[a + A[i]][b + j] %= MOD;
					pw = pw * A[i] % MOD;
				}
			}
		}
		sa += A[i];
		sb += B[i] - 1;
		swap(dp, ndp);
	}
	ll ans = 0;
	for (int a = 1; a <= sa; ++a) {
		ll inva = inv[a];
		ll pw = sa * modex(a, MOD - 2) % MOD;
		for (int b = 0; b <= sb; ++b) {
			ans -= dp[a][b] * fac[b] % MOD * pw;
			ans %= MOD;
			pw = pw * inva % MOD;
		}
	}
	if (ans < 0) ans += MOD;
	printf("%lld\n", ans);
}


Measured memory_bytes: 2816
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>

using namespace std;

static array<int, 10> kWeights = {
	{ 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 }
};

int main()
{
	int n, m;
	cin >> n >> m;

	vector<int> nums(m);
	for (int& num : nums) {
		cin >> num;
	}
	sort(nums.begin(), nums.end(), [](int i, int j) { return j < i;  });

	vector<int> vals(1+n);
	vector<int> cur_nums(1+n);
	
	for (int i = 1; i <= n; i++) {
		int cur_num = 0;
		int max_val = 0;
		for (int& num : nums) {
			if (i < kWeights[num]) {
				continue;
			}
			if (vals[i - kWeights[num]] < 0) {
				continue;
			}

			int cur_val = vals[i - kWeights[num]] + 1;
			if (max_val < cur_val) {
				max_val = cur_val;
				cur_num = num;
			}
		}

		if (cur_num != 0) {
			vals[i] = vals[i - kWeights[cur_num]] + 1;
			cur_nums[i] = cur_num;
		}
		else {
			vals[i] = -1;
		}
	}

	int i = n;
	map<int, int> use_nums;
	while (i != 0) {
		use_nums[cur_nums[i]]++;
		i = i - kWeights[cur_nums[i]];
	}

	stringstream ss;
	for (auto it = use_nums.rbegin(); it != use_nums.rend(); it++) {
		for (int i = 0; i < it->second; i++) {
			ss << it->first;
		}
	}
 
	cout << ss.str() << endl;

	return 0;
}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int a,b;cin>>a>>b;

  for(int i=1;i<=1000000;i++){
    int t1 = i*0.08;
    int t2 = i*0.1;
    if(t1==a&&t2==b){
      cout<<i<<endl;
      return 0;
    }
  }

  cout<<-1<<endl;

  
  return 0;
}


Measured memory_bytes: 256
S = input()

ans = len(S)
for i in range(26):
    c = chr(ord('a') + i)
    if not c in S: continue
    if all([c==a for a in S]):
        print(0)
        exit()
    arr = list(S)
    tmp = 0
    while 1:
        arr2 = []
        diff = False
        tmp += 1
        for a,b in zip(arr,arr[1:]):
            if a==c or b==c:
                arr2.append(c)
            else:
                arr2.append(a)
                diff = True
        if not diff:
            break
        arr = arr2
    ans = min(ans, tmp)
print(ans)

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

void dfs(int u, vector<bool>& visited, const vector<vector<int>> &g, vector<int>& dp){
    visited[u] = true;
    for (int i = 0; i < g[u].size(); i++){
        int v = g[u][i];
        if (!visited[v]){
            dfs(v, visited, g, dp);
        }
        dp[u] = max(dp[u], 1 + dp[v]);
    }
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n + 1);
    for (int i = 0; i < m; i++){
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
    }
    vector<int> dp(n + 1, 0);
    vector<bool> visited(n + 1, false);
    for (int u = 1; u <= n; u++){
        if (!visited[u]) dfs(u, visited, g, dp);
    }
    int res = 0;
    for (int x:dp){
        res = max(res, x);
    }
    cout << res;
}


Measured memory_bytes: 9472
#include <iostream>
#include <math.h>
#include <string>

using namespace std;

int main(){
    int N, ac=0 , wa=0, tle=0, re=0;
    string s;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> s;
        if(s == "AC") ac++;
        if(s == "WA") wa++;
        if(s == "TLE") tle++;
        if(s == "RE") re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

    return(0);
}

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

constexpr int64_t MOD = 1e9+7;

int main() {
    int64_t n, m;
    cin >> n >> m;
    vector<int64_t> x(n), y(m);
    for (auto& e : x) cin >> e;
    for (auto& e : y) cin >> e;
    int64_t accx = 0, accy = 0;
    for (int64_t i = 0; i+1 < n; i++) accx = (accx + (x[i+1] - x[i]) * (i+1) % MOD * (n-i-1) % MOD) % MOD;
    for (int64_t i = 0; i+1 < m; i++) accy = (accy + (y[i+1] - y[i]) * (i+1) % MOD * (m-i-1) % MOD) % MOD;
    cout << accx * accy % MOD << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int>a(5);
  for(int i=0;i<5;i++){
    cin>>a[i];
  }
  for(int i=0;i<5;i++){
    if(a[i]==0) 
      cout<<i+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	for (int a = 1; a <= 9; a++) {
		for (int b = 1; b <= 9; b++) {
			if (a * b == N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 3500
import java.util.Scanner;
import java.util.Arrays;

public class Main{
	static boolean[] primes = new boolean[123456*2+1];

	static void Furui(){
		Arrays.fill(primes, true);
		for(int i=2; i<=123456*2; i++){
			if(!primes[i]) continue;
			int j = i + i;
			while(j<=123456*2){
				primes[j] = false;
				j += i;
			}
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Furui();

		while(true){
			int n = sc.nextInt();
			if(n==0) break;
			int cnt = 0;
			for(int i=n+1; i<=2*n; i++){
				if(primes[i]) cnt++;
			}
			System.out.println(cnt);
		}
	}
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;
const ll MOD = 1e9 + 7;


int main() {
    int n; cin >> n;
    V<ll> a(n);
    ll sum = 0, cnt = 0, zero = 0, mi = INF;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] < 0) cnt++;
        if(a[i] == 0) zero++;
        sum += abs(a[i]);
        mi = min(mi, abs(a[i]));
    }

    if(cnt % 2 == 0 || zero){
        cout << sum << endl;
    }else{
        cout << sum - mi * 2 << endl;
    }

}


Measured memory_bytes: 1024
#pragma warning (disable :4996)
#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 10;

int n, q, S[N], key;
int sum = 0;
int BinarySearch(int A[], int n, int key) {
	int le = 0, r = n - 1, mid = (le + r) / 2;
	while (le<=r) {
		mid = (le + r) / 2;
		if (A[mid] == key) return 1;
		if (A[mid] > key) r = mid - 1;
		if (A[mid] < key) le = mid + 1;
	}
	return 0;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", &S[i]);
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		scanf("%d", &key);
		if (BinarySearch(S, n, key)) sum++;
	}
	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 3508
import java.util.Scanner;
  public class Main {
  public static void main(String[] args) {
   // ?¨??????\???????????????????????????????????????
   Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] values = new int[w];
   for (int i = 0; i < values.length; i++) {
      values[i] = i + 1;
   }
   for (int i = 0; i < n; i++) {
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
       // a??¨b????????£???values??????????????????
      int tmp = 0;
      tmp = values[a];
      values[a] = values[b];
      values[b] = tmp;
   }
       // values??????????????????
for(int i = 0;i < w;i++){
       System.out.println(values[i]);
}
  }
}

Measured memory_bytes: 26076
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<algorithm>

#define ll long long
#define sz 100005

using namespace std;

int main()
{
    ll a,b;

    scanf("%lld %lld",&a,&b);

    if(a+b>=10)
        printf("error\n");

    else
        printf("%lld\n",a+b);

    return (0);
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n,i,h_max,result=0;
  int h[20];
  
  scanf("%d",&n);
  scanf("%d",&h[i]);
  h_max=h[i];
  result++;

  for(i=1;i<n;i++){
    scanf("%d",&h[i]);
    if(h_max<=h[i]){
      h_max=h[i];
      result++;
    }
  }
  
  printf("%d",result);
}
  

Measured memory_bytes: 128
n = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(n):
    if a[i] == 0:
        print(0)
        exit()
for i in range(1, n):
    ans = ans * a[i]
    if ans > 10**18:
        print(-1)
        exit()
    
print(ans)

Measured memory_bytes: 21792
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
  ll n,t1;
  cin >>n>>t1;
  ll t[n];
  for(ll i=0;i<n;i++) cin >>t[i];
  ll ans=0;
  for(ll i=0;i<n-1;i++){
    ll k=t[i+1]-t[i];
    if(k<t1) ans+=k;
    else ans+=t1;
  }
  cout <<ans+t1<<endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n;
int H[N];
int dp[N];
void solve(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&H[i]);
	int ans=0;
	dp[n+1]=-1;
	for(int i=n;i>=1;i--){
		if(H[i]>=H[i+1])dp[i]=dp[i+1]+1;
		else dp[i]=0;
		ans=max(ans,dp[i]);
	}
	printf("%d\n",ans);
}
int main(){
    solve();
    return 0;
}

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

int cmp(const int *a,const int *b){
  return *a-*b;
}
int main(){
  int n,k,h[100000],i,d;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++) scanf("%d",&h[i]);
  qsort(h,n,sizeof(int),cmp);
  d=h[k-1]-h[0];
  for(i=k;i<n;i++){
    if(d>h[i]-h[i-k+1]) d=h[i]-h[i-k+1];
  }
  printf("%d",d);
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 10);
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    a[l]++;
    a[r + 1]--;
  }
  int cnt = 0;
  rep(i, n) {
    if (0 < i) a[i] += a[i - 1];
  }
  rep(i, n) if (a[i] >= m) cnt++;
  cout << cnt << endl;
}


Measured memory_bytes: 3784
S = gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
T = gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
S.freeze
T.freeze
s = S.split("")
t = T.split("")

len = s.length
ans = 0

for num in 0..s.length-1 do
  if s[num] != t[num] then
    ans = ans + 1
  end
end
puts ans

Measured memory_bytes: 35104
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

s = readline().strip()
t = readline().strip()
q = int(readline())
abcd = list(map(int,read().split()))

cumsum_s = [0] * (len(s)+1)
cumsum_t = [0] * (len(t)+1)
for cs,st in zip([cumsum_s,cumsum_t],[s,t]):
    for i,ch in enumerate(st,1):
        cs[i] = cs[i-1] + (1 if ch=='A' else 2)

ans = []
it = iter(abcd)
for a,b,c,d in zip(it,it,it,it):
    num1 = cumsum_s[b] - cumsum_s[a-1]
    num2 = cumsum_t[d] - cumsum_t[c-1]
    if((num1-num2)%3 == 0):
        ans.append('YES')
    else:
        ans.append('NO')

print('\n'.join(ans))

Measured memory_bytes: 114468
#include <stdio.h>

int main(void)
{
int a,b,c,i,x;
scanf("%d %d %d",&a,&b,&c);
x=0;

for(i=a;i<=b;i++){
if( c%i ==0){
x++;
}
}
printf("%d\n",x);

 return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound

int main(){
  int H,W;
  cin>>H>>W;
  VS S(H);
  rep(i,H) cin>>S[i];
  ll mod=1e9+7;
  VVL X(H,VL(W,0));
  X[0][0]=1;
  rep(i,H) rep(j,W){
    auto push=[&](int A,int B){
      if(S[i+A][j+B]=='.'){
        (X[i+A][j+B]+=X[i][j])%=mod;
      }
    };
    if(S[i][j]=='.'){
      if(i<H-1) push(1,0);
      if(j<W-1) push(0,1);
    }
  }
  cout<<X[H-1][W-1]<<endl;
}

Measured memory_bytes: 9216
#include <algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;

long mapp[51][51];
bool seen[51][51];
int W,H;

// 八方向への移動ベクトル
const int dx[8] = {1, 0, -1, 0, -1, 1 ,-1, 1};
const int dy[8] = {0, 1, 0, -1, -1,-1 , 1, 1};

void dfs(int w,int h){

  seen[h][w] = true;
  int ii,jj;
  int nx,ny;

  for(ii=0;ii<8;ii++){

    nx = w + dx[ii];
    ny = h + dy[ii];

    if(nx < 0 || ny < 0 || nx >= W || ny >= H){continue;}
    if(mapp[ny][nx] == 0){continue;}
    if(seen[ny][nx] == true){continue;}

    //cout << "H:" << H << "W:" << W << "nx:" << nx << "ny:" << ny << endl;
    dfs(nx,ny);
  }

  
}

int main(){

  long ii,jj,kk;
  vector<int> ret;


  while(true){
    cin >> W >> H;
    //cout << "W:" << W << "H:" << H <<endl;
    if(W == 0){
      break;
    }
    memset(mapp,0,sizeof(mapp));    
    for(ii=0;ii<H;ii++){
      for(jj=0;jj<W;jj++){
        cin >> mapp[ii][jj];
      }
    }

    memset(seen,0,sizeof(seen));

    int cnt=0;

    for(ii=0;ii<H;ii++){
      for(jj=0;jj<W;jj++){

        //cout << "ii:" << ii << "jj:" << jj << endl;
        if(mapp[ii][jj] == 1 && seen[ii][jj] == false){
          //cout << "ii:" << ii << "jj:" << jj << endl;
          dfs(jj,ii);
          cnt++;
        }
      }
    }

    cout << cnt << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3208
package main

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

func main() {
	io := newIo()
	defer io.Flush()
	n := io.NextInt()
	absSum := 0.0
	var absMin float64
	negativeCount := 0
	for i := 0; i < n; i++ {
		a := io.NextFloat()
		if a < 0 {
			negativeCount++
		}
		absA := math.Abs(a)
		absSum += absA
		if i == 0 || absA < absMin {
			absMin = absA
		}
	}
	log("negativeCount", negativeCount)
	log("absSum", absSum)
	log("absMin", absMin)
	if negativeCount&1 == 0 {
		fmt.Println(int64(absSum))
	} else {
		fmt.Println(int64(absSum - (2 * absMin)))
	}
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}


Measured memory_bytes: 7040
import sys
x = int(input())
if (x == 1000):
    print(1000)
    sys.exit()
list = []
list.append(1)
for i in range(30):
    tmp = (i+2)**2
    while (tmp <= 1000):
        list.append(tmp)
        tmp = tmp*(i+2)
list.sort()
tmp = list[0]
for i in list:
    if (i > x):
        print(tmp)
        sys.exit()
    tmp = i


Measured memory_bytes: 3060
import itertools
h,w,k = map(int,input().split())
c = []
row = list(itertools.product(range(2),repeat=h))#塗る行の組み合わせ
col = list(itertools.product(range(2),repeat=w))#塗る列の組み合わせ
for i in range(h):
    c.append(input())

ans = 0

for arr_row in row:
    for arr_col in col:
        val = 0
        for i in range(h):
            for j in range(w):
                if c[i][j] == "#" and arr_row[i] == 1 and arr_col[j] == 1:
                    val +=1
        if val == k:
            ans +=1
print(ans)

Measured memory_bytes: 68192
#include"iostream"
using namespace std;

int main()
{
	int n, d, x;
	cin >> n >> d >> x;
	int a[110];
	for (int i = 0; i < n; i++)cin >> a[i];
	int ans = 0;
	for (int i = 0; i < n; i++)ans += (d - 1) / a[i] + 1;
	cout << ans + x << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    s = SI()

    odd = s[0::2]
    even = s[1::2]
    dprint(even, odd)
    if set(even) - set(['L', 'U', 'D']) == set() and set(odd) - set(['R', 'U', 'D']) == set():
        print('Yes')
    else:
        print('No')

solve()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}
ll nCr(ll n, ll r){//mod逆元　nCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){if(b==0) return a; return gcd(b, a%b);}
bool isPrime(int x){
    if(x==1) return false;
    else if(x==2) return true;
    else if(x%2==0) return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0){
            return false;
        }
    }
    return true;
}

int main(){
    fast_io

    int n,m;
    cin>>n>>m;
    vector<int> L(m), R(m);
    rep(i, m) cin>>L[i]>>R[i];
    int r_min=100100100;
    int l_max=0;
    rep(i,m){
        l_max = max(L[i], l_max);
        r_min = min(R[i], r_min);
    }
    int ans=r_min - l_max + 1;
    if(ans<=0) cout<<0<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**5+10)
def memo(v):
    if dp[v]!=-1:return dp[v]
    ans = 0
    for next_v in g[v]:
        ans = max(ans,memo(next_v)+1)
    dp[v] = ans
    return ans

n,m = map(int,input().split())
g = [[] for _ in range(n+1)]
for _ in range(m):
    x,y = map(int,input().split())
    g[x].append(y)
    
dp = [-1]*(n+1)

ans = 0
for v in range(1,n+1):
    ans = max(ans, memo(v))
    
print(ans)


Measured memory_bytes: 61172
def kaibun(arr):
    count = 0
    arr_len = len(arr) - 1

    if arr_len % 2 == 0:
        for i in range(0, int(arr_len / 2)):
            if arr[i] != arr[arr_len-i]:
                count += 1
        return count
    else:
        for i in range(0, int((arr_len + 1) / 2)):
            if arr[i] != arr[arr_len-i]:
                count += 1
        return count


if __name__ == "__main__":
    s = input()
    arr = list(s)
    print(kaibun(arr))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define FOR(x, z, y) for(int x = (z); y; x++)
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; FOR(cnt, 0, getline(stream,res,sp_word))
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
#define digit(x) ((int)log10((double)(x)) + 1)
#define vec(x) vector<x>
const int MOD = 1000000007; 
typedef long long ll;
using namespace std;
typedef string str;

 
int main() {
  int N,M;
  scanf("%d%d",&N,&M);
  str bord[N];
  str pattern[M];

  rep(i,N) cin >> bord[i];
  rep(i,M) cin >> pattern[i];

  function<bool(int,int)> match = [&](int x, int y){
    rep(i,M)
      rep(j,M)
       if(bord[x + i][y + j] != pattern[i][j])
         return false;

    return true;
  };

  bool found = false;
  rep(x,N - M + 1)
    rep(y,N - M + 1)
      if(match(x,y)) found = true;

  printf("%s",found ? "Yes" : "No");
  return 0;
}

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

int main()
{
  int N;
  float ans = 0;
  cin >> N;

  for (int i = 0; i < N; ++i) {
    int Ai;
    cin >> Ai;

    ans += 1.0f / Ai;
  }
  
  cout << (1.0f / ans) << endl;
}


Measured memory_bytes: 256
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN
#define TC 0 

using namespace std;
using ll = long long;

void testcase() {
    int x, y;
    cin >> x >> y;
    int a = x * 2, b = x * 4;

    if (y % 2 == 0 && y >= a && y <= b) {
        cout << "Yes";
    } else
        cout << "No";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    if (TC)
        cin>>t;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];

int main() {
  int N, A; cin >> N >> A;
  if (N < A) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }
}



Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <cmath>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
const ll MOD = 998244353;
 
int main() {
    ll h, w, k;
    cin >> h >> w >> k;
    vector<string> table(h);
    vector<vector<ll>> ans(h, vector<ll>(w, 0));
    set<ll> skiped;
    for (ll i = 0; i < h; ++i) {
        cin >> table[i];
        string s(table[i]);
    }

    auto now = 1;
    for (ll i = 0; i < h; ++ i) {
        ll count = 0;
        for (ll j = 0; j < w; ++j) {
            if (table[i][j] == '#') {
                ++count;
            }
        }
        if (count == 0) {
            if (i > 0 && ans[i-1][0] != 0) {
                for (ll k = 0; k < w; ++k) {
                    ans[i][k] = ans[i-1][k];
                }
            }
            continue;
        }
        for (ll j = 0; j < w; ++j) {
            ans[i][j] = now;
            if (table[i][j] == '#' && count > 1) {
                ++now;
                --count;
            }
        }
        for (ll k = 1; i - k >= 0 && ans[i-k][0] == 0; ++k) {
            for (ll l = 0; l < w; ++l) {
                ans[i-k][l] = ans[i][l];
            }
        }
        ++now;
    }
    for (ll i = 0; i < h; ++i) {
        for (ll j = 0; j < w; ++j) {
            if (j != 0) {
                cout << " ";
            }
            cout << ans[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define F first
#define S second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int Inf = 1e9;
const double EPS = 1e-9;



int main()
{
  int n ;
  cin >> n ;
  vector<int> time(n) ;
  REP(i,n){
    cin >> time.at(i) ;
  }
  int m ;
  cin >> m ;
  vector<pair<int,int>> drink(m) ;
  REP(i,m){
    int a, b ;
    cin >> a >> b;
    drink.at(i) = make_pair(a,b) ;
  }
  int sum = 0 ;
  
  REP(i,m){
    int a = drink.at(i).F ;
    int b = drink.at(i).S ;
    int tmp = time.at(a-1) ;
    time.at(a-1) = b ;
    REP(j,n){
      sum += time.at(j) ;
    }
    cout << sum << endl ;
    sum = 0 ;
    time.at(a-1) =tmp ;
  }

  return 0 ;
}




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

int main()
{
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 0; i < n - 1; i++)
  {
    if (s[i] != s[i + 1])
    {
      ans++;
    }
  }
  cout << ans + 1 << endl;
}
  

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
//#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N,M;
int A[200010],B[200010];
vector<int> G[200010];
int C[200010];
bool F[200010];
int d[200010];
queue<int> Q;

signed main(){
	cin>>N>>M;
	REP(i,M){
		cin>>A[i]>>B[i];
		A[i]--,B[i]--;
		G[A[i]].push_back(B[i]);
		G[B[i]].push_back(A[i]);
	}
	REP(i,N){
		d[i]=INF;
	}
	d[0]=0;
	Q.push(0);
	while(Q.size()){
		int s=Q.front();Q.pop();
		REP(i,G[s].size()){
			int e=G[s][i];
			if(d[e]>d[s]+1){
				d[e]=d[s]+1;
				C[e]=s;
				Q.push(e);
			}
		}
	}
	cout<<"Yes"<<endl;
	for(int i=1;i<N;i++){
		cout<<C[i]+1<<endl;
	}
	return 0;
}


Measured memory_bytes: 19172
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <climits>
#include <cmath>

using namespace std;
using Pos = std::pair<int, int>;
//cout<<fixed<<std:cout<<fixed<<setprecision(2)<<Max<<endl;
constexpr int mod = 1e9 + 7;

int main() {
    int N,C,K;
    cin>>N>>C>>K;

    vector<int> T(N);
    for(auto& t:T)
        cin>>t;

    sort(begin(T),end(T));
    if(C==1){
        cout<<N<<endl;
    }else {
        int ans = 0;

        int time = T[0];
        int wait = 1;
        for(int i = 1; i < N; ++i) {
            if(wait>=C){
                ++ans;
                time=T[i];
                wait=1;
            }else{
                if(T[i]-time>K){
                    ++ans;
                    wait=1;
                    time=T[i];
                }else{
                    ++wait;
                }
            }
        }
        ++ans;
        cout<<ans<<endl;
    }

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ldb long double
#define mt meke_tuple
template<typename T> bool ckmn(T &a, T b){ T c=a;a=min(a,b);return a!=c;}
template<typename T> bool ckmx(T &a, T b){ T c=a;a=max(a,b);return a!=c;}

const int mod=998244353;
int add(int a, int b){ a+=b;return a>=mod?a-mod:a;}
void ckadd(int &a, int b){ a=add(a,b);}
int sub(int a, int b){ a-=b;return a<0?a+mod:a;}
void cksub(int &a, int b){ a=sub(a,b);}
int mul(int a, int b){ return (ll)a*b%mod;}
void ckmul(int &a, int b){ a=mul(a,b);}
int powmod(int x, int k){ int ans=1;for(;k;k>>=1,ckmul(x,x)) if(k&1) ckmul(ans,x);return ans;}
int inv(int x){ return powmod(x,mod-2);}

const int N=4050;
int F[N],I[N];
int binom(int n, int k){ return mul(F[n],mul(I[k],I[n-k]));}
void calc()
{
	F[0]=1;
	for(int i=1;i<N;i++) F[i]=mul(F[i-1],i);
	I[N-1]=inv(F[N-1]);
	for(int i=N-2;~i;i--) I[i]=mul(I[i+1],i+1);
}

int dp[N][N],r[N],b[N];
int main()
{
	calc();
	dp[0][0]=1;
	string s;
	cin>>s;
	int n=s.size(),i,j;
	for(i=0;i<n;i++)
	{
		r[i+1]=r[i]+(2-(s[i]-'0'));
		b[i+1]=b[i]+(s[i]-'0');
	}
	for(i=n+1;i<=n*2;i++) r[i]=r[i-1],b[i]=b[i-1];
	for(i=0;i<n*2;i++) for(j=0;j<=i;j++)
	{
		int B=j,R=i-j;
		if(r[i+1]>R)
		{
			dp[i+1][j]=add(dp[i+1][j],dp[i][j]);
		}
		if(b[i+1]>B)
		{
			dp[i+1][j+1]=add(dp[i+1][j+1],dp[i][j]);
		}
	}
	int ans=0;
	for(i=0;i<=2*n;i++) ans=add(ans,dp[n*2][i]);
	printf("%i\n",ans);
	return 0;
}


Measured memory_bytes: 62336
#include <iostream>
#include <cstdio>
#include <cmath>

int main(int argc, char** argv)
{
	double a, b, deg;
	std::cin >> a >> b >> deg;

	double rad = deg * 3.141592653589793 / 180.0;

	double h = sin(rad) * b;
	double s = a * h * 0.5;
	double l = a + b + sqrt((a * a) + (b * b) - (2 * a * b * cos(rad)));

	printf("%.5lf\n", s);
	printf("%.5lf\n", l);
	printf("%.5lf\n", h);

	return 0;
}


Measured memory_bytes: 3456
n=int(input())
a=list(map(int,input().split()))
b={}
p=0
for i in range(n):
    if a[i] in b :
        b[a[i]]+=1
    else:
        b[a[i]]=1
for key,val in b.items():
    p+=val*(val-1)//2



for i in range(n):
    t=b[a[i]]
    s=t*(t-1)//2
    r=(t-1)*(t-2)//2

    print(p-s+r)

Measured memory_bytes: 86348
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
int main(void) {
  string s;
  cin >> s;
  int count = 0;
  rep(i,3) {
    if(s[i] == '1') {
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	int a[3][3];
	char b[101]={};
	int n, i, j;
	for(i=0; i<3; i++){
		for(j=0; j<3; j++){
			scanf("%d", &a[i][j]);
		}
	}
	scanf("%d", &n);
	for(i=0; i<n; i++){
		int B;
		scanf("%d", &B);
		b[B]=1;
	}
	if(0){
	}else if(b[a[0][0]]!=0 && b[a[0][1]]!=0 && b[a[0][2]]!=0){
	}else if(b[a[1][0]]!=0 && b[a[1][1]]!=0 && b[a[1][2]]!=0){
	}else if(b[a[2][0]]!=0 && b[a[2][1]]!=0 && b[a[2][2]]!=0){
	}else if(b[a[0][0]]!=0 && b[a[1][0]]!=0 && b[a[2][0]]!=0){
	}else if(b[a[0][1]]!=0 && b[a[1][1]]!=0 && b[a[2][1]]!=0){
	}else if(b[a[0][2]]!=0 && b[a[1][2]]!=0 && b[a[2][2]]!=0){
	}else if(b[a[0][0]]!=0 && b[a[1][1]]!=0 && b[a[2][2]]!=0){
	}else if(b[a[0][2]]!=0 && b[a[1][1]]!=0 && b[a[2][0]]!=0){
	}else{
		puts("No");
		return 0;
	}
	puts("Yes");
}


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

int main(){
  int n,k,x,y,a;
  cin>>n>>k>>x>>y;
  
  if(k>n){
    a=n*x;
  }else{
  	a=k*x+(n-k)*y;
  }
  cout<<a;
  
  return 0;
}
  


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

#define pb  push_back
#define mp  make_pair
#define ll  long long
#define itr iterator

typedef pair<ll,ll> pii;

const ll MAX=2e5+9;
const ll INF=1e12;

map<ll,ll> maps;

ll N,M,X,Y;

signed main()
{
	ios_base::sync_with_stdio(false);

	 
	cin>>N>>M;
	for(int A=1;A<=M;A++)
	{
		cin>>X>>Y;
		maps[X]^=1;
		maps[Y]^=1;
	}
	for(auto A:maps)
		if(A.second%2)
			return cout<<"NO",0;
	cout<<"YES";
	return 0;
}

Measured memory_bytes: 5632
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>

typedef long long int64;

int main(void) {
  int n;
  std::cin >> n;
  std::map<int, int> m;
  for (int i = 0; i < n; i++) {
    int a;
    std::cin >> a;
    m[a]++;
  }

  bool ans = true;
  for (auto el : m) {
    if (el.second >= 2) {
      ans = false;
    }
  }

  std::cout << (ans ? "YES" : "NO") << std::endl;

  return 0;
}


Measured memory_bytes: 9600
while ((n,x = gets.split(" ").map(&:to_i)).inject(:+) != 0) do
  max = 3*(n-1)
  if !((6..max).include?(x))
    puts 0
    next
  end
  count = 0
  catch(:stop) do
    n.downto(1) do |n1|
      (n1-1).downto(1) do |n2|
        n3 = x - n1 - n2
        count += 1 if (n3 < n2) && (n3 > 0)
        throw :stop if (n3 > n1)
        break if (n3 > n2)
      end
    end
  end
  puts count
end

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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    bool  ans=true;
    rep(i, 0, n){
        ll a;
        cin >> a;
        if(a%2==1){
            cout << "first" << endl;
            return 0;
        }
    }
    cout << "second" << endl;
    return 0;
}

Measured memory_bytes: 3596
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine();

        var res = new List<char>();
        for(var i = 0; i < s.Length; i++)
        {
            if ((i + 1) % 2 != 0) 
                res.Add(s[i]);
        }
        
        Console.WriteLine(string.Join("", res));
    }
}


Measured memory_bytes: 28120
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#include <bitset>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
const int MAX = 510000;

int n,m,r;
int p[8];
int d[200][200];
void warshall_floyd(){
    for(int k=0;k<n;k++){
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
}
signed main(){
    cin>>n>>m>>r;
    for(int i=0;i<r;i++)cin>>p[i];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            d[i][j]=INF;
        }
    }
    for(int i=0;i<n;i++)d[i][i]=0;
    for(int i=0;i<m;i++){
        int a,b,c;
        cin>>a>>b>>c;
        d[a-1][b-1]=c;
        d[b-1][a-1]=c;
    }
    warshall_floyd();
    int ans=INF;
    sort(p,p+r);
    do{
        int cnt=0;
        for(int i=0;i<r-1;i++)cnt+=d[p[i]-1][p[i+1]-1];
        ans=min(ans,cnt);
    }while(next_permutation(p,p+r));
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
	long int h,w;
	long int i;

	scanf("%ld %ld",&h,&w);
	if(h==1||w==1){
		printf("1");
		return 0;
	}
	if(h%2==1){
		if(w%2==1){
			printf("%ld",h*w/2+1);
			return 0;
		}else{
			printf("%ld",h*w/2);
			return 0;
		}
	}else{
		printf("%ld",h*w/2);
		return 0;
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
const int MOD=1e9+7;
#define pb push_back
#define cy cout<<"Yes\n"
#define cn cout<<"No\n"
#define ci cout<<"impossible\n"
typedef unsigned long long int ull;
typedef long long int ll;
const int MAX=500005;
ll ar[MAX],br[MAX];
const int M=1e4;
ll cnt[M];
int main()
{
    ll n;
    cin>>n;
    cnt[0]=1;
    ll a=0;
    for(int i=3;i<=n;i++)
    {
        a+=cnt[i-3];
        a%=MOD;
        cnt[i]=a;
    }
    cout<<cnt[n]<<endl;
}




Measured memory_bytes: 3608
package main

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

func Solve(stdin io.Reader, stdout io.Writer) {
	sc := bufio.NewScanner(stdin)

	sc.Scan()
	s := sc.Text()

	ret := 0
	from := 0
	to := -1
	for i, v := range(s) {
		if v == 'A' || v == 'C' || v == 'G' || v == 'T' {
			to = i
		} else {
			from = i + 1
		}
		if to - from + 1 > ret {
			ret = to - from + 1
		}
	}

	_, _ = fmt.Fprintf(stdout, "%d\n", ret)
}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}

Measured memory_bytes: 640
#include <iostream>
#include <string.h>

using namespace std;

int main() {
    string str;
    string ans;
    cin >> str;
    int check = 0;
    char c[3];
    c[0] = str[0];
    c[1] = str[1];
    for (int i = 0; i < str.length(); i++) {
        if (c[0] != str[i] && c[1] != str[i]) {
            check = 1;
        }
    }
    if (check) {
        if (str[0] == str[str.length() - 1]) {
            if (str.length() % 2 == 0) {
                ans = "First";
            } else { ans = "Second"; }

        } else {
            if (str.length() % 2 == 0) {
                ans = "Second";
            } else { ans = "First"; }
        }
    } else { ans = "Second"; }
    cout << ans << endl;
    return 0;
}
//while (cin >> str) {
///* 何か処理 */
//}
//long long n,t;
//long long a[100005];
//long long uru[100005]={0};
//cin>>n>>t;
//for(int i=0;i<n;i++){
//cin>>a[i];
//}
//#include<stdio.h>
//#include<algorithm>
//using namespace std;
//char in[110000];
//int main(){
//    scanf("%s",in);100
//    int ret=0;
//    for(int i=0;in[i];i++){
//        if(i&&in[i]!=in[i-1])ret++;
//    }
//    printf("%d\n",ret);
//}

//int a,b;scanf("%d%d",&a,&b);
//for(int i=0;i<a;i++)scanf("%d",p+i);
//#include <iostream>
//#define REP(i,n) for (int i=0;i<(n);i++)

//int main() {
//
//    std::cout << "Hello, World!" << std::endl;
//    return 0;
//}

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

#define N 1000001
#define nil NULL

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

int n;
int main(){
  int i,key;
  scanf("%d",&n);
  int A[n];
  for(i=1;i<=n;i++){
    scanf("%d",&key);
    A[i] = key;
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i!=1) printf("parent key = %d, ",A[parent(i)]);
    if(2*i<= n) printf("left key = %d, ",A[left(i)]);
    if(2*i+1<=n) printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  return 0;
}

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

int main(){
  string str;
  getline(cin,str);
  for(int i = 0; i < str.size();i++){
    if(str[i] >= 'a' && str[i] <= 'z'){
      str[i] = toupper(str[i]);
  cout << str[i];

//文字が英大文字かどうか判定
}else if(str[i] >= 'A' && str[i] <= 'Z'){
  str[i] = tolower(str[i]);
  cout << str[i];
}else{
  cout << str[i];
}
  }
  cout << endl;
  return 0;
}


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

using namespace std;

long long n,p,i;
long long a[1000];
long long mem[1000][8];

long long DP(int pos, int sisa) {
    if (pos == n) {
        if (sisa == p) return 1; else return 0;
    }
    if (mem[pos][sisa] != -1) return mem[pos][sisa];
    
    long long ans = DP(pos+1,sisa) + DP(pos+1,(sisa+a[pos])%2);
    return mem[pos][sisa] = ans;
}

int main() {
    scanf("%lld%lld",&n,&p);
    for (i=0 ; i<n ; i++) {
        scanf("%lld",&a[i]);
    }
    
    for (i=0 ; i<n ; i++) {
        mem[i][0] = -1;
        mem[i][1] = -1;
    }
    
    printf("%lld\n",DP(0,0));
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<iomanip>
#include<string>
#include<string.h>
#include<cctype>
#include<algorithm>
using namespace std;
int main()
{
    int i=0,j=0,Count=0;
    string s;
    string s2;
    cin>>s>>s2;
    for(i=0;i<s.length() ;i++)
        {
            if(s[i]!=s2[j])
                Count++;
                j++;


        }
        cout<<Count;
















    return 0;
}



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

using namespace std;

#define N_TIMES(i, n)     for (uint64_t i = 0;     i <  n; ++i)
#define N_TIMES_REV(i, n) for ( int64_t i = n - 1; i >= 0; --i)

int main(int argc, char **argv)
{
  uint64_t N;
  cin >> N;
  
  string S;
  cin >> S;
  
  vector<uint64_t> black(N + 1, 0), white(N + 1, 0);
  N_TIMES(n, N) {
    black[n + 1] = ((S[n] == '#') ? 1 : 0) + black[n];
    white[n + 1] = ((S[n] == '.') ? 1 : 0) + white[n];
  }
  
  uint64_t count = -1;
  N_TIMES(n, N + 1) {
    uint64_t pw = n, pb = N - n;
    uint64_t qw = white[n] - white[0];
    uint64_t qb = black[N] - black[n];
    
    count = min(count, (pw - qw) + (pb - qb));
  }
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 3716
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
n=N()
l=L()
ans=1
for i in l:
    ans*=i
    if ans>10**18:
        if 0 in l:
            print(0)
        else:
            print(-1)
        break
else:
    print(ans)

Measured memory_bytes: 22468
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
  int q, c, a, n, ans, t;

  cin >> q;
  for(int i = 0;i < q; i++){
    cin >> c >> a >> n;
    ans = min(c, min(a, n));
    c -= ans; a -= ans; n -= ans;
    t = min(c / 2, a);
    c -= t * 2; a -= t;
    ans += t + (c / 3);
    cout << ans << endl;
  }
}


Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(void){
    int N, K;
    string S;
    cin >> N >> K >> S;

    int sum{0};

    vector<int> zero_s;
    vector<int> zero_e;
    vector<int> one_s;
    vector<int> one_e;
    bool flag{false};

    for(int i{0}; i<N; ++i){
        if(S[i]=='0'){
            if(flag==false){
                zero_s.push_back(i);
                ++sum;
                flag = true;
            }
        }
        else if(flag==true){
            zero_e.push_back(i-1);
            flag = false;
        }
    }

    if(zero_s.size() != zero_e.size())
        zero_e.push_back(N-1);

    if(K>=sum){
        cout << N << endl;
        return(0);
    }

    else{
        int max{0};
        int count;

        for(int i{0}; i+K<=zero_s.size(); ++i){
            if(i == 0)
                count = zero_s[i+K];
            else if(i+K == zero_s.size())
                count = N-1 -  zero_e[i-1];
            else
                count = zero_s[i+K]-1 - zero_e[i-1];
            if(count > max)
                max = count;
        }

        cout << max << endl;
        return(0);
    }
}


Measured memory_bytes: 1020