akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

lli n;

int main(void){
    cin >> n;
    lli c, k;
    c = k = 0;
    rep(i, n){
        lli a;
        cin >> a;
        if(a%2 == 0) c++;
    }
    if(c != n){
        cout << "first" << endl;
    }else{
        cout << "second" << endl;
    }
    return 0;
}


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

const int MAX_N = 100005;
const int MAX = 2000000005;

int N, K;
int mem[MAX_N];
int heights[MAX_N];

int dp(int stone) {
  if (stone == N) return 0;
  if (stone > N) return MAX;
  if (mem[stone] != -1) return mem[stone];

  int best = MAX;
  for (int i = stone + 1; i <= stone + K; ++i) {
    if (i > N) break;
    best = std::min(best, dp(i) + std::abs(
      heights[stone] - heights[i]));
  }
  mem[stone] = best;
  return best;
}

int main() {
  memset(mem, -1, sizeof(mem));
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; ++i) {
    scanf("%d", heights + i + 1);
  }

  printf("%d\n", dp(1));
}


Measured memory_bytes: 10844
fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(java.util.Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: java.util.Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toLong()
        val K = sc.next().toLong()

        val n = N % K
        val ans = listOf(n, K - n).min()
        pw.println(ans)
    }
}


Measured memory_bytes: 34116
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

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



	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		Set<Long> m = new HashSet<Long>();
		long cnt=0;
		for(int i=0; i<n; i++) {
			long v=sc.nextLong();
			if(m.contains(v)) {
				m.remove(v);
				cnt--;
			} else {
				m.add(v);
				cnt++;
			}
		}
		System.out.println(cnt);
		sc.close();
	}

}


Measured memory_bytes: 64644
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

int main() {
  int A, B;
  cin >> A >> B;
  if (A <= 8 && B <= 8) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] x = new int[w];
        for(int i=0;i<w;i++){
            x[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;
            int c;
            c = x[a];
            x[a] = x[b];
            x[b] = c;
        }
        for(int i=0;i<w;i++){
            System.out.println(x[i]);
        }
    }
}



Measured memory_bytes: 26112
import sys
from io import StringIO
import unittest

sys.setrecursionlimit(10**5*2)

def search(u, n, g, disc, k):
    if disc[u] != None:
        circles = n - disc[u]
        v = (k - disc[u]) % circles
        ans = u
        if n > k:
            ans = 0
            for _ in range(k):
                ans = g[ans]
            return ans + 1
        for i in range(v):
            ans = g[ans]
        return ans + 1
    disc[u] = n
    return search(g[u], n+1, g, disc, k)

def resolve():
    n, k = map(int, input().split())
    g = list(map(lambda x: int(x) - 1, input().split()))
    disc = [None]*n
    v = search(0, 0, g, disc, k)
    print(v)
resolve()

Measured memory_bytes: 213568
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def comb_mod(n, r):
    res = 1
    r = min(n - r, r)

    for i in range(r):
        res *= (n - i)
        res %= MOD
        res *= pow((r - i), MOD - 2, MOD)

    return res


def main():
    n, m, k = list(map(int, readline().split()))

    com = comb_mod(n * m - 2, k - 2)
    x = 0
    y = 0

    for i in range(n):
        right = n - 1 - i
        x += (right + 1) * right // 2
        x %= MOD

    for i in range(m):
        down = m - 1 - i
        y += (down + 1) * down // 2
        y %= MOD

    ans = 0
    ans += m ** 2 * x * com
    ans += n ** 2 * y * com
    ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 40556
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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 T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) 
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }

int n, a[210], b[210];
string str;

int main() {
    while (cin >> n) {
        if (n == 0) break;
        cin >> str;
        for (int i = 0; i < n; ++i) { cin >> a[i] >> b[i]; --a[i], --b[i]; }
        for (int i = n-1; i >= 0; --i) {
            int ia = str[a[i]] - 'a'; ia += b[i]-a[i]; ia %= 26;
            str[a[i]] = (char)('a' + ia);
            int ib = str[b[i]] - 'a'; ib += b[i]-a[i]; ib %= 26;
            str[b[i]] = (char)('a' + ib);
            swap(str[a[i]], str[b[i]]);
        }
        cout << str << endl;
    }
    return 0;
}


Measured memory_bytes: 1200
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;

vector<int> p[100001];

int main(){

  lll ii,jj,kk;
  vector<int> ret;
  int n,m;
  vector<int> h;

  cin >> n >> m;

  h.resize(n);
  
  for(ii=0;ii<n;ii++){
    cin >> h[ii];
  }

  int p1,p2;


  for(ii=0;ii<m;ii++){
    cin >> p1 >> p2;

    p[p1-1].push_back(p2-1);
    p[p2-1].push_back(p1-1);

  }

  int cnt=0;
  int myH;

  bool flg;

  for(ii=0;ii<n;ii++){
    myH = h[ii];
    flg = true;

    if(p[ii].size() == 0){

    }

    else{
      for(jj=0;jj<p[ii].size();jj++){
        if(h[p[ii][jj]] >= myH){
          flg=false;
          break;
        }
      }
    }
    
    if(flg){
      cnt++;
    }

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


Measured memory_bytes: 8752
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
int a[10][10];
signed main()
{
	int n, ans = 0, ans2 = 0;
	scanf("%d", &n);
	for(int i = 1, j = 1; i <= n; ++i)
	{
		if(i == j * 10)
		{
			j *= 10;
		}
		ans += a[i % 10][i / j];
		++a[i / j][i % 10];
		ans2 += i / j == i % 10;
	}
	printf("%d\n", ans * 2 + ans2);
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    ll A;
    long double B;
    cin >> A >> B;
    cout << (ll)floor(A * B) << endl;
}


Measured memory_bytes: 3728
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

typedef vector<int> VI;
#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IFOR(v,it) for(VI::iterator it=(v).begin();it!=(v).end();++it)


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

  int sum = 0;
  vector<int> W;
  REP(i, N) {
    int w;
    cin >> w;
    W.PB(w);
    sum += w;
  }

  int res = 10000000;
  FOR(T, 0, N) {
    int s1 = 0;
    REP(i,T) {
      s1 += W[i];
    }
    int s2 = sum - s1;
    res = min(res, abs(s1 - s2));
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
typedef long double dl;
#define PI  3.14159265358979323846
#define M  998244353
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }

    }
}
ll lcm(ll a,ll b)
{
    ll g=__gcd(a,b);
    return ((a*b)/g);
}
int pal(string S)
{
    int n=S.length();
    int ok=1,i;
    for(i=0;i<n;i++)
    {
        if(S[i]!=S[n-i-1])
        {
            ok=0;
            break;
        }
    }
    return ok;
}
int d(int n)
{
    int y=n*(n-1);
    y/=2;
    return y;
}
int main()
{
  int n,m;
  cin>>n>>m;
  int p,q;
  cout<<d(n)+d(m);

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
lint mod = 1000000007;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

// pは素数
// 事前処理 COMinit() の計算量はn
// https://drken1215.hatenablog.com/entry/2018/06/08/210000
const lint MAX = 5e5+10;  // nCkのn,kの最大値
const lint MOD = mod;
lint fac[MAX];  // i!
lint inv[MAX];  // i^(-1)
lint finv[MAX];  // (i!)^(-1)

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
lint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
////////////////////////////////

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

  COMinit();

  lint ans=0;
  rep(i,n+1){
    ans+=(i%2==0?1:-1)
    *COM(n,i)
    %mod*fac[m]
    %mod*finv[m-i]
    %mod*fac[m-i]
    %mod*fac[m-i]
    %mod*finv[m-n]
    %mod*finv[m-n]
    %mod;
    ans%=mod;
  }
  ans+=mod;
  return ans%mod;
}

int main(){cout<<app()<<endl;return 0;}


Measured memory_bytes: 15340
#include<stdio.h>

int main(void)
{

    int a,b;

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

    if(a < b)
      printf("a < b\n");
    else if(a > b)
      printf("a > b\n");
    else
      printf("a == b\n");

    return 0;
}



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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    bool ok = false;
    rep(i,n){
        cin >> a[i];
        if(a[i]==1) ok =true;
    }
    if(!ok){
        cout << "-1" << endl;
        return 0;
    }

    int ans = n,k = 0,i = 1;
    for(int j = k;j < n;j++){
        if(a[j]==i){
            ans--;
            k = j+1;
            i++;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
# C
H, W = map(int, input().split())
 
res = min(H, W)
# split H
h = round(H / 3)
w = W // 2
s1 = h*W
s2 = (H-h)*w
s3 = (H-h)*(W-w)
res = min(res, max(s1,s2,s3) - min(s1,s2,s3))
# split W
w = round(W / 3)
h = H // 2
s1 = w*H
s2 = (W-w)*h
s3 = (W-w)*(H-h)
res = min(res, max(s1,s2,s3) - min(s1,s2,s3))
    
# 3
if H % 3 == 0 or W % 3 == 0:
    res = 0
print(res)



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

const ll mod = 1e9 + 7;

int main()
{
    int N;
    scanf("%d", &N);
    int A[N];
    REP(i, 0, N) A[i] = 0;
    REP(i, 0, N) { 
        int tmp;
        scanf("%d", &tmp);
        ++A[tmp];
    }

    bool flg = true;
    if(N%2) {
        if(A[0] != 1) flg = false;
        for(int i = 2; i < N; i += 2) if(A[i] != 2) flg = false;
    }
    else {
        for(int i = 1; i < N; i += 2) if(A[i] != 2) flg = false;
    }
    if(!flg) { cout << 0 << endl; return 0; }
    ll res = 1;
    while(N > 1) res = res*2LL%mod, N -= 2;
    printf("%lld\n", res);
    return 0;
}

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

ll t[105][100005];
vector<int> wt, val;

ll knapsack(int n, int w){
    if(n==0 || w==0) return 0;

    if(t[n][w]!=-1) return t[n][w];

    if(wt[n-1]<=w){
        return t[n][w] = max(val[n-1] + knapsack(n-1, w-wt[n-1]), 
                            knapsack(n-1, w));
    }
    else return t[n][w] = knapsack(n-1, w);
}

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

    memset(t, -1, sizeof(t));
    int n, w; cin>>n>>w;
    wt.resize(n);
    val.resize(n);

    for(int i = 0; i<n; i++) cin>>wt[i]>>val[i];

    cout<<knapsack(n, w)<<"\n";
    return 0;
}

Measured memory_bytes: 85704
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  
  ll N;
  cin>>N;
  
  vector<ll>a(N);
  vector<bool>b(N);
  rep(i,N){
cin>>a[i];
  }
  
  
  rep(i,N){
b[i]=false;
  }

 
 ll M=0;
 for(ll i=N-1;i>=0;i--){
   ll sum=0;
   ll j=i;
while(j<=N-1){
if(b[j]){
  sum++;
}
    j+=i+1;
}
   
   
   if(sum%2==0&&a[i]==1){
b[i]=true;
     M++;
   }
else if(sum%2==1&&a[i]==0){
b[i]=true;
  M++;
} 
  }
cout<<M<<endl;

  rep(i,N){
if(b[i]){
cout<<i+1<<endl;
}
  }
}
 

Measured memory_bytes: 2560
N = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))


V = [100] * (2*sum(t) + 1)
T = 0
for i in range(N):
    for j in range(T+1, T+t[i]*2+1):
        V[j] = min(V[j], v[i])
    T += t[i]*2

for i in range(min(len(V), 201)):
    V[i] = min(V[i], i*0.5)
for i in range(min(len(V), 201)):
    V[-i-1] = min(V[-i-1], i*0.5)
V
T = 0
for i in range(N-1):
    T += t[i]*2
    vi = min(V[T], v[i], v[i+1])
    for j in range(201):
        if T-j >= 0:
            V[T-j] = min(V[T-j], vi+0.5*j)
        if T+j <= len(V)-1:
            V[T+j] = min(V[T+j], vi+0.5*j)

V
ans = 0
for i in range(len(V)-1):
    ans += 0.5*0.5*(V[i]+V[i+1])
print(ans)


Measured memory_bytes: 3444
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    A = LI()

    memo = {}
    ans = 0
    for i, a in enumerate(A):
        i = i + 1
        # print(i, a - i, i - a)
        ans = ans + memo.get(i - a, 0)
        memo[a + i] = memo.get(a + i, 0) + 1
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 40544
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0

#a<=b<=c とする
#a,b 固定
#cf : http://drken1215.hatenablog.com/entry/2019/10/20/032700
for i in range(N):
 for j in range(i,N):
   if(i != j):
    a,b = L[i],L[j]
    a_plus_b = a+b
    k = bisect.bisect_left(L,a+b)
    tmp = max(0, k-(j+1))
    count += tmp
    
print(count)

Measured memory_bytes: 45276
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
const int M=55;
#define inf 0x7fffffff
char s[M][M];
int val[M][M];
int n,m;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
inline char getc(){
	char ch=getchar();
	while(ch!='.'&&ch!='#') ch=getchar();
	return ch;
}
int main(){
	n=read();m=read();
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			char ch=getc();
			if(ch=='.') continue;
			val[i][j]=-inf;
			val[i][j-1]+=1;
			val[i][j+1]+=1;
			val[i-1][j-1]+=1;
			val[i-1][j+1]+=1;
			val[i-1][j]+=1;
			val[i+1][j]+=1;
			val[i+1][j-1]+=1;
			val[i+1][j+1]+=1;
		}
	}
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			if(val[i][j]<0)
				cout<<"#";
			else cout<<val[i][j];
		}cout<<endl;
	}return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int N,A,B;

int main(void){
	scanf("%d",&N);
	switch(N){
		case 1:
			printf("Hello World");
			break;
		case 2:
			scanf("%d",&A);
			scanf("%d",&B);
			printf("%d",A+B);
			break;
	}
	return 0;
}

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

int main()
{
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    int ans = 0;
    rep(is, 1<<h)rep(js, 1<<w) {
        int cnt = 0;
        rep(i,h)rep(j,w){
            if(is>>i&1) continue;
            if(js>>j&1) continue;
            if(s[i][j] == '#') cnt++;
        }
        if(cnt == k) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
n = input()
n = int(n)
d = {}

for i in range(n):
    tmp = input()
    # print(type(tmp))
    if tmp in d :
        d[tmp] += 1
    else :
        d[tmp] = 1

sd = sorted(d.items(), key=lambda x:x[1], reverse=True)

num = 0
l =[]
for k in sd:
    if k[1] < num:
        break
    num = k[1]
    l.append(k[0])

l.sort()

for n in l:
    print(n)


Measured memory_bytes: 45788
M, D = map(int, input().split())
count = 0
for m in range(M, 0, -1):
  if m >= 4:
    for day in range(D, 0, -1):
      d2 = day // 10
      d1 = day - d2 * 10
      if d2 >= 2:
        if d1 >= 2:
          if d1 * d2 == m:
            count += 1
print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
int a[10010], b[10010];
int main() {
	int n;
	cin >> n;
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	ll l = 0, r = 0;
	rep(i,n) {
		if (a[i] > b[i]) l += a[i] - b[i];
		if (a[i] < b[i]) {
			r += (b[i]-a[i]) / 2;
			
		}
	}
	if (l <= r) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3716
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>


using namespace std;


int main(void){
  
  int A,B,C;

  cin >> A >> B >> C ;

  int sum = A + B +C;

if(sum > 21){
    cout << "bust" << endl;
  }else{
    cout << "win" << endl;
  }


  

  return 0;
}



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

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


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

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string a, b; cin >> a >> b;
    if(a.length() > b.length()) {
        cout << "GREATER" << endl;
        return 0;
    }

    if(a.length() < b.length()) {
        cout << "LESS" << endl;
        return 0;
    }

    for(int i = 0; i < a.length(); i++){
        if(a[i] > b[i]){
            cout << "GREATER" << endl;
            return 0;
        }

        if(a[i] < b[i]){
            cout << "LESS" << endl;
            return 0;
        }
    }
    cout << "EQUAL" << endl;

    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static string Solve(int sx, int sy, int tx, int ty)
        {
            int dx = tx - sx;
            int dy = ty - sy;
            var sb = new StringBuilder();
            sb.Append(new string('L', 1));
            sb.Append(new string('U', dy + 1));
            sb.Append(new string('R', dx + 1));
            sb.Append(new string('D', dy + 1));
            sb.Append(new string('L', dx));
            sb.Append(new string('U', dy));
            sb.Append(new string('R', dx + 1));
            sb.Append(new string('D', dy + 1));
            sb.Append(new string('L', dx + 1));
            sb.Append(new string('U', 1));
            return sb.ToString();
        }
        static void Main(string[] args)
        {
            int[] V = ReadInts();
            Console.WriteLine(Solve(V[0], V[1], V[2], V[3]));
        }
    }
}


Measured memory_bytes: 13220
X, N = map(int, input().split())
if N==0: print(X);exit()
p = list(map(int, input().split()))
count = 0
while True:
  if X - count not in p:
    print(X-count)
    exit()
  if X + count not in p:
    print(X+count)
    exit()
  count += 1

Measured memory_bytes: 9192
// -------- START : snippet -------- //

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

struct IoSetup {
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
} iosetup;

// -------- START : macro -------- //

#define ll long long
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define len(c) (ll)c.size()
#define all(v) (v).begin(),(v).end()
#define lb(v,x) (lower_bound(all(v),x)-v.begin())
#define ub(v,x) (upper_bound(all(v),x)-v.begin())
#define has(c,x) (c.find(x) != c.end())
#define uniq(v) v.erase(unique(all(v)),v.end())
#define bit(k) (1LL<<(k))
#define INF int(1e9)

template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

// -------- END : macro -------- //

// -------- START : debug macro -------- //

template<class T,class U> ostream& operator<<(ostream& ost, const pair<T,U> &p) { ost << "(" << p.first << ", " << p.second << ")"; return ost; }
#define ostream_container { ost << "{"; for(const auto &t : v) { if (&t != &*v.begin()) ost << ", "; ost << t; } ost << "}"; return ost; }
template<class T> ostream& operator<<(ostream &ost, const vector<T> &v) ostream_container
template<class T> ostream& operator<<(ostream &ost, const set<T> &v) ostream_container
template<class T,class U> ostream& operator<<(ostream &ost, const map<T,U> &v) ostream_container

template<class H> void recursive_debug(string s, H h) {
    cerr << "\033[33m" << s << " = " << h << endl << "\033[m";
}
template<class H,class... T> void recursive_debug(string s, H h, T... t) {
    int comma = s.find(',');
    cerr << "\033[33m" << s.substr(0,comma) << " = " << h << ", ";
    recursive_debug(s.substr(comma+1), t...);
}
#define debug(...) recursive_debug(#__VA_ARGS__, __VA_ARGS__)

// -------- END : debug macro -------- //

// -------- END : snippet -------- //

int main(void) {
    string s;
    cin >> s;
    int cnt = 0;
    int res = 0;
    rep(i,3){
        if (s[i] == 'R') cnt++;
        else cnt = 0;
        chmax(res, cnt);
    }
    cout << res << endl;
    return 0;
}


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

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int[] S = new int[N];
		int ans = 0;
		for(int i = 0;i < N;i++) {
			S[i] = scn.nextInt();
			ans+=S[i];
		}
		Arrays.sort(S);
		int c = 0;
		while(ans %10==0 && c<N) {
			if(c == 0) {
				ans -= S[c];
			}else {
				ans+=S[c-1];
				ans-=S[c];
			}
			c++;
		}
		System.out.println(ans%10==0?0:ans);
	}

}


Measured memory_bytes: 22868
use std::io::*;

fn main() {
    let input = {
        let mut buf = vec![];
        stdin().read_to_end(&mut buf);
        unsafe { String::from_utf8_unchecked(buf) }
    };
    let mut lines = input.split('\n');

    let s = lines.nth(1).unwrap();

    let mut cnt = 0;
    let mut iter = s.as_bytes().windows(2);

    while let Some(b) = iter.next() {
        match b {
            b"OX" | b"XO" => {
                cnt += 1;
                iter.next();
            },
            _ => { }
        }
    }

    println!("{}", cnt);
}



Measured memory_bytes: 5024
#include <stdio.h>
int fibonacci(int);
int d[50];
int main(){
  int n,i;
  for(i=0;i<50;i++)d[i]=-1;
  
  scanf("%d",&n);
  printf("%d\n",fibonacci(n));
	 
  return 0;
}

int fibonacci(int n){
  if(n==0||n==1)return d[n]=1;
  if(d[n]!=-1)return d[n];
  return d[n]=fibonacci(n-2)+fibonacci(n-1);
}





Measured memory_bytes: 2148
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int ans = 0;

		boolean flagA = false;
		boolean flagB = false;
		boolean flagC = false;

		if (a >= b) {
			flagB = true;
		} else {
			flagA = true;
		}

		if(flagA){
			if(b >= c) {
				flagC = true;
			} else {
				flagB = true;
			}
		} else {
			if(a >= c) {
				flagC = true;
			} else {
				flagA = true;
			}
		}

		if (flagA) {
			ans = ans + a;
		}

		if (flagB) {
			ans = ans + b;
		}

		if (flagC) {
			ans = ans + c;
		}

		System.out.println(ans);

	}
}

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

int main(){
    int n,y=0;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(int i = 0;i < n;i++){
        if(s[i] == 'I'){
            ans++;
        }else if(s[i] == 'D'){
            ans--;
        }
        if(ans > y){
            y=ans;
            
        }
        
        
    }
    
    cout << y << endl;
    
    
    
}


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

string S;
long long N, P;
long long R[1 << 18], power[1 << 18];
long long cnt[1 << 18];

int main() {
	cin >> N >> P >> S;
	
	if (P == 2 || P == 5) {
		long long ans = 0;
		for (int i = 0; i < N; i++) {
			if ((S[i] - '0') % P == 0) ans += (i + 1);
		}
		cout << ans << endl;
	}
	else {
		power[0] = 1;
		for (int i = 1; i <= N; i++) power[i] = (10LL * power[i - 1]) % P;
		for (int i = N - 1; i >= 0; i--) {
			R[i] = (R[i + 1] + (S[i] - '0') * power[N - i - 1]) % P;
		}
		for (int i = 0; i <= N; i++) cnt[R[i]]++;

		long long ans = 0;
		for (int i = 0; i < P; i++) ans += 1LL * cnt[i] * (cnt[i] - 1) / 2LL;
		cout << ans << endl;
	}
	return 0;
}

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

using namespace std;

// #define int long long

#ifndef bhupixb
    #define var(...)
    #define stl(...)
#endif

#define rep(i,a,b) for (int i = a; i <= (int)b; ++i)
#define f first
#define s second

#define single_test


const int max_nodes = 22;
using edge = int32_t;
vector<edge> g[max_nodes];
void add_edge(int u, int v) {
    g[u].emplace_back(v);
}


constexpr int mod = 1e9 + 7;

struct M {
    unsigned v;
    M(long long a = 0) : v((a %= mod) < 0 ? a + mod : a) {}
    M& operator+=(M r) { if ((v += r.v) >= mod) v -= mod; return *this; }
    M& operator-=(M r) { if ((v += mod - r.v) >= mod) v -= mod; return *this; }
    M& operator*=(M r) { v = (uint64_t)v * r.v % mod; return *this; }
};

uint32_t add(M a, M b) { return (a += b).v; }
uint32_t mul(M a, M b) { return (a *= b).v; }
uint32_t sub(M a, M b) { return (a -= b).v; }

uint32_t po(M x, int n) {
    M res(1);
    while (n > 0) {
        res *= (n & 1 ? x : 1);
        x *= x; n /= 2;
    }
    return res.v;
}


int n, mx;
int dp[1 << 21];

int go(int mask) {
    if (mask == mx) {
        return 1;
    }
    int pos = __builtin_popcount(mask);
    auto &ref = dp[mask];
    if (ref != -1) {
        return ref;
    }
    int ans = 0;
    // var(pos);
    for (int adj: g[pos]) {
        if (!((mask >> adj) & 1)) {
            ans = add(ans, go(mask | (1 << adj)));
        }
    }
    return ref = ans;
}

void solve() {
    cin >> n;
    int x;
    memset(dp, -1, sizeof dp);
    rep(i,0,n-1) {
        rep(j,0,n-1) {
            cin >> x;
            if (x) {
                add_edge(i, j);
            }
        }
    }
    mx = (1 << n) - 1;
    cout << go(0) << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t = 1;
    #ifndef single_test
        cin >> t;
    #endif
    for (int i = 1; i <= t; ++i) {
        // cout << "Case #" << i << ": ";
        solve();
    }

    return 0;
}

Measured memory_bytes: 11816
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

int N;
map<int, int> f;

signed main(){
    cin >> N;
    FOR(x, 1, 101){
        FOR(y, 1, 101){
            FOR(z, 1, 101){
                f[x * x + y * y + z * z + x * y + y * z + z * x]++;
            }
        }
    }
    FOR(n, 1, N + 1){
        PRINT(f[n]);
    }
    return 0;
}

Measured memory_bytes: 5420
#pragma GCC optimize("O3") //コンパイラ最適化用

#define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはメントされる
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--) //ループ変数は1ずつデクリ
#define FOR(i, a, b) for (ll i = a; i < ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i > ll(b); i--) //ループ変数は1ずつデクリ
// xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end() // sortなどの引数を省略したい
#define SIZE(x) ll(x.size())      // sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 // 10^12:極めて大きい値,∞
#define MOD 1000000007    // 10^9+7:合同式の法
#define MAXR 100000 // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back // vectorヘの挿入
#define MP make_pair // pairのコンストラクタ
#define F first      // pairの一つ目の要素
#define S second     // pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set
#define P pair<ll, ll>
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000

int main() {

    ll n, q;
    string s;
    cin >> n >> s >> q;
    vector<set<ll>> char_idcs(26);
    REP(i, n) { char_idcs[s[i] - 'a'].insert(i); }
    REP(qi, q) {
        ll typ;
        cin >> typ;

        if (typ == 1) {
            ll idx;
            char c;
            cin >> idx >> c;
            --idx;

            char_idcs[s[idx] - 'a'].erase(idx);
            s[idx] = c;
            char_idcs[c - 'a'].insert(idx);

        } else {
            ll l, r;
            cin >> l >> r;
            l--;

            ll num_typ = 0;
            REP(i, 26) {
                auto searched_r = char_idcs[i].lower_bound(l);
                if (searched_r != char_idcs[i].end() && *searched_r < r) {
                    num_typ++;
                }
            }
            cout << num_typ << endl;
        }
    }
}


Measured memory_bytes: 27260
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n;
    cin >> n;
    vec a(n);
    rep(i, n) cin >> a[i];

    deque<int> b;

    rep(i, n) {
        if (i % 2 == 0) {
            b.push_back(a[i]);
        }
        else {
            b.push_front(a[i]);
        }
    }

    if (n % 2 == 0) {
        rep(i, n) {
            if (i != 0) cout << " ";
            cout << b[i];
        }
        cout << endl;
    }
    else {
        rep(i, n) {
            if (i != 0) cout << " ";
            cout << b[n-1-i];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 4800
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)

signed main(){
    int R,G,B;

    cin>>R>>G>>B;

    if((R*100+G*10+B)%4==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}



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

typedef long long int ll;

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    
    string s;
    cin >> s;
    
    for (int i = 1; i < (int) s.length(); ++i)
    {
        if (s[i] == s[i - 1])
        {
            cout << "Bad\n";
            return 0;
        }
    }
    
    cout << "Good\n";

    return 0;
}


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

#define INF 100000000

typedef struct state {
  int pos, cost;
} state;

state A[2000001];
int N = 0;

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

void swap( state* a, state* b ) {
  state tmp = *a;
  *a = *b;
  *b = tmp;
}

void minHeapify ( int i ) {
  int l = left(i);
  int r = right(i);
  int small;

  if ( l <= N && A[l].cost < A[i].cost ) small = l;
  else small = i;

  if ( r <= N && A[r].cost < A[small].cost ) small = r;

  if ( small != i ) {
    swap ( &A[i], &A[small] );
    minHeapify(small);
  }
}

state heapExtractMin() {
  if ( N < 1 ) return (state) {0,0};
  state min = A[1];
  A[1] = A[N];
  N--;
  minHeapify(1);
  return min;
}

void heapIncreaseKey( int i , state key ) {
  if ( key.cost > A[i].cost) return;

  A[i] = key;
  while ( i > 1 && A[parent(i)].cost > A[i].cost ) {
    swap( &A[i], &A[parent(i)]);
    i = parent(i);
  }
}

void minHeapInsert( state key ) {
  N++;
  A[N] = (state) { INF, INF };
  heapIncreaseKey(N, key);
}

typedef struct edge{
  int to,cost;
} edge;

edge* G[10000];
int size[10000];
int n;
int d[10000];
edge e;
state s;

int main() {
  int a,b;
  cin >> n;
  for ( int i = 0; i < n; i++ ) {
    cin >> a >> b;
    G[a] = (struct edge*)malloc( sizeof(edge )*b );
    size[a] = b;
    for ( int j = 0; j < b; j++ ) {
      cin >> G[a][j].to >> G[a][j].cost;
    }
    d[i] = INF;
  }
  d[0] = 0;
  minHeapInsert ( (state{0,0} ) );
  while(N!=0) {
    s = heapExtractMin();
    if ( s.cost > d[s.pos]) continue;
    for ( int i = 0; i < size[s.pos]; i++ ) {
      e = G[s.pos][i];
      if ( d[e.to] <= d[s.pos] + e.cost ) continue;
      d[e.to] = d[s.pos] + e.cost;
      minHeapInsert((state){e.to,d[e.to]});
    }
  }
  for ( int i = 0; i < n; i++ ) {
    cout << i << " " << d[i] << endl;
  }
}

Measured memory_bytes: 5172
"use strict"

function Main(input) {
    const N = parseInt(input[0], 10);
    const Q = parseInt(input[1], 10);
    const ab = input.slice(2, (N - 1) * 2 + 2).map(n =>{
        return parseInt(n, 10);
    });
    const px = input.slice((N - 1) * 2 + 2).map(n =>{
        return parseInt(n, 10);
    });

    let nodeList = [0];
    for (let i = 0; i < ab.length; i = i + 2) {
        nodeList[ab[i + 1] - 1] = ab[i];
    }

    let addList = new Array(N);
    addList.fill(0);
    for (let i = 0; i < px.length; i = i + 2) {
        addList[px[i] - 1] += px[i + 1];
    }

    let result = new Array(N);
    for (let i = 0; i < N; i++) {
        if (i === 0) {
            result[i] = addList[i];
        } else {
            result[i] = result[nodeList[i] - 1] + addList[i];
        }
    }

    console.log(result.join(' '));

}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 121140
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan= new Scanner(System.in);
        int n=scan.nextInt();
        HashMap<Integer,Integer> map= new HashMap<Integer, Integer>();
        for(int i=0;i<n-1;i++){
            int x=scan.nextInt();
            if(!map.containsKey(x)){
                map.put(x,1);
            }
            else {
                map.replace(x, map.get(x) + 1);
            }
        }
        for(int i=0;i<n;i++){
            if(map.containsKey(i+1)){
                System.out.println(map.get(i+1));
            }
            else System.out.println(0);
        }
    }
}


Measured memory_bytes: 72660
fun main(args: Array<String>) {
    val bingoCard = Array(3) { readInputLine().split(" ").map { it.toInt() }.toIntArray() }
    val bingo = Array(3) { BooleanArray(3) }
    val N = readInputLine().toInt()
    for (i in 1..N) {
        val b = readInputLine().toInt()
        for (j in 0..2) {
            for (k in 0..2) {
                if (bingoCard[j][k] == b) {
                    bingo[j][k] = true
                }
            }
        }
    }

    for (i in 0 until 3) {
        if (bingo[i][0] && bingo[i][1] && bingo[i][2]) {
            println("Yes")
            return
        }
        if (bingo[0][i] && bingo[1][i] && bingo[2][i]) {
            println("Yes")
            return
        }
    }

    if (bingo[0][0] && bingo[1][1] && bingo[2][2]) {
        println("Yes")
        return
    }

    if (bingo[2][0] && bingo[1][1] && bingo[0][2]) {
        println("Yes")
        return
    }

    println("No")
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 36328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
  public static void main(String[] args) throws IOException {
     
    try( BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
 
      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;
 
      if( inStr.length() >= target.length()) {
        if( ring.indexOf(target) != -1) result = "Yes";
      }
 
      System.out.println(result);
    }
  }
}


Measured memory_bytes: 24444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		if(x>=k){
			ans++;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int flag = 1, n;
  cin >> n;
  int a;
  for(int i = 0; i < n; i++){
    cin >> a;
    if(a % 2 == 0)
    {
      if(a % 3 == 0 || a%5 == 0)
        flag = flag&1;
      //if(a % 5 == 0)
      //  flag = flag&1;
      else
        flag = 0;
    }
  }
  if(flag)
    cout << "APPROVED" ;
  else
    cout << "DENIED";
  return 0;
}

    

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define Max(a,b) a>b?a:b
#define Min(a,b) a<b?a:b

int max_3(int a, int b, int c){
	int ans;
	int tmp;
	tmp = Max(a,b);
	ans = Max(tmp,c);
	return ans;
}

int min_3(int a, int b, int c){
	int ans;
	int tmp;
	tmp = Min(a,b);
	ans = Min(tmp,c);
	return ans;
}

int main(int argc, char *argv[]){
	int a,b,c;
	int minNum, maxNum;
	scanf("%d%d%d",&a,&b,&c);

	minNum = min_3(a,b,c);
	maxNum = max_3(a,b,c);
	printf("%d %d\n",minNum, maxNum);
	exit(0);
}


Measured memory_bytes: 2148
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")

#define DEBUG(x) cout << ">> " << #x << ": " << x << endl;
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
typedef long long ll;
typedef long double ld;

int main() { _
  int n, k; cin >> n >> k;
  int count = 0;
  for (; n != 0; n /= k) count++;
  cout << count << endl;
  return 0;
}

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

int main() {
    int N,M;
    cin >> N >> M;
    vector<int> A(M),B(M);
    for ( int i = 0; i < M; ++i){
        int x,y;
        cin >> x >> y;
        A.at(i) = x - 1;
        B.at(i) = y - 1;
    }
    
    vector<vector<int>> C;
    C.resize(N);
    for ( int i = 0; i < M; ++i){
        C[A.at(i)].push_back(B.at(i));
        C[B.at(i)].push_back(A.at(i));
    }
    
    vector<int> done(N,-1);
    done.at(0) = 0;
    queue<vector<int>> que;
    
    vector<int> search(3);
    for ( int i = 0; i < C[0].size(); ++i){
        search.at(0) = C[0][i];
        search.at(1) = 0;
        search.at(2) = 0;
        que.push(search);
    }
    
    while ( que.size() ){
        search = que.front(); que.pop();
        int pos = search.at(0);
        int cnt = search.at(1);
        int prepos = search.at(2);
        if ( done.at(pos) == -1 ){
            done.at(pos) = prepos + 1;
            for ( int i = 0; i < C[pos].size(); ++i){
                search.at(0) = C[pos][i];
                search.at(1) = cnt + 1;
                search.at(2) = pos;
                que.push(search);
            }
        }
    }
    
    bool flg = true;
    for ( int i = 0; i < N; ++i){
        //cout << done.at(i) << endl;
        if ( done.at(i) == -1 ){
            flg = false;
        }
    }
    
    if ( flg ){
        cout << "Yes" << endl;
        for ( int i = 1; i < N; ++i ){
            cout << done.at(i) << endl;
        }
    } else {
        cout << "No" << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 29416
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k; cin >> n >> k;
	long double p = 0;
	for(int i = 1; i <= n; i++){
		long double q = 1;
		for(int j = i; j < k; j *= 2) q *= 0.5;
		p += q;
	}
	cout << fixed << setprecision(12) << p/n << endl;
	return 0;
}


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

using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  
    long long a, b, n;
    cin >> a >> b >> n;
    long long ans = (a * min(b-1, n)) / b;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3552
alphabetTable = dict.fromkeys([chr(i) for i in range(97, 123)], 0)

while True:
    try:
        for text in input():
            for i in range(len(text)):
                if text[i].lower() in alphabetTable:
                    alphabetTable[text[i].lower()] += 1
    except EOFError:
        break

for r in sorted(alphabetTable):
    print(r,':',alphabetTable[r])

Measured memory_bytes: 6724
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,cnt=0;
  int a;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    if(a%2==1)cnt++;
  }
  if(cnt%2==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <stdio.h>

int a[3];

void swap(int i, int j);

int main(void)
{
  int i, j;

  for(i = 0; i < 3; i++)
    {
      scanf("%d", &a[i]);
    }

  for(i = 0; i < 3; i++)
    {
      for(j = i + 1; j < 3; j++)
	{
	  if(a[i] > a[j])
	    {
	      swap(i, j);
	    }
	}
    }

  printf("%d %d %d\n", a[0], a[1], a[2]);

  return 0;
}

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

  return;
}

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int main(void)
{
    int a, b, k;
    cin >> a >> b >> k;
    vector<int> out{0};
    if(a<b)
    {
        swap(a,b);
    }
    int i;
    for(i=gcd(a,b);i>0;i--)
    {
        if((a%i == 0) && (b%i == 0))
        {
            out.push_back(i);
        }
    }

    cout << out[k] << endl;

    return 0;
}

Measured memory_bytes: 256