akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int a, b;

int main() {
	cin >> a >> b;
	if(a == b) { cout << "Draw" << endl; return 0; }
	
	cout << ((a + 13) % 15 > (b + 13) % 15 ? "Alice" : "Bob") << endl;
	
	return 0;
}


Measured memory_bytes: 256
module Main where

import qualified Data.Vector as V
import           Data.List
import           Control.Applicative
import           Control.Monad

main :: IO ()
main = do
  n <- getLine
  k <- readLn
  xs <- sort . map read . words <$> getLine
  print $ f xs k 0

f [] _ d = d
f (x:xs) k d = f xs k d + min (2 * x) (2 * (k - x))

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n,p,t=0;
	string s;
	cin>>n>>p;
	cin>>s;
	ll ans=0;
	if(p==5)
	{
		for(int i=0;i<n;i++)
		{
			if((s[i]-'0')%p==0)ans+=(i+1);
		}
	}
	else if(p==2)
	{
		for(int i=0;i<n;i++)
		{
			if((s[i]-'0')%p==0)ans+=(i+1);
		}
	}
	else
	{	map<int, int> mp;
		mp[0]++;int p2=1;
		for(int i=n-1;i>=0;i--)
		{
			t=(t+(s[i]-'0')*p2)%p;
			ans=ans+mp[t];
			mp[t]++;
			p2=(p2*10)%p;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 900
//  Created by liszt on 2019/08/01.
#include<bits/stdc++.h>
using namespace std;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
ll cnt = 0;
ll gcd(ll x,ll y){
   return y ? gcd( y , x%y ) : x;
}



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

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  char s[3][3]={};
  int i;
  for(i=0;i<3;i++)
  {
    scanf("%s",s[i]);
  }
  for(i=0;i<3;i++)
  {
    printf("%c",s[i][i]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(string, s, t);
	s.PB(t.BA);
	OUT(s == t ? "Yes" : "No");
}


Measured memory_bytes: 3596
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=sys.stdin.readline
def resolve():
    s=input()
    flag=True
    for i in range(len(s)):
        if i%2==0 and s[i]=='L':
            flag=False
        elif i%2==1 and s[i]=='R':
            flag=False
    print("Yes" if flag else "No")

resolve()

Measured memory_bytes: 38384
#include <iostream>
using namespace std;
int main(){
    
   int S[13],H[13],C[13],D[13],N,num;
   char mark;
   cin>>N;
   for(int i=0;i<13;i++) S[i]=0,H[i]=0,C[i]=0,D[i]=0;
   for(int i=0;i<N;i++){
       cin>>mark>>num;
       if(mark=='S')S[num-1]=1;
       if(mark=='H')H[num-1]=1;
       if(mark=='C')C[num-1]=1;
       if(mark=='D')D[num-1]=1;
   }
   
   for(int i=0;i<13;i++)if(S[i]==0)cout<<"S "<<i+1<<endl;
   for(int i=0;i<13;i++)if(H[i]==0)cout<<"H "<<i+1<<endl;
   for(int i=0;i<13;i++)if(C[i]==0)cout<<"C "<<i+1<<endl;
   for(int i=0;i<13;i++)if(D[i]==0)cout<<"D "<<i+1<<endl;
   
    return 0;
}


Measured memory_bytes: 3064
#include <iostream>

using namespace std;
const long long MOD = 1000000007;

long long power(long long x, long long y) {
    long long ans = 1;

    while (y > 0) {
        if (!(y % 2)) {
            x = x * x % MOD;
            y = y / 2;
        } else {
            ans = ans * x % MOD;
            y--;
        }
    }

    return ans;
}

int main() {
    int h, w, a, b;

    cin >> h >> w >> a >> b;

    long long factorial[200000], invFactorial[200000];

    factorial[0] = 1;

    for (int i = 0; i < h+w-2; i++) {
        factorial[i+1] = factorial[i] * (i+1) % MOD;
    }

    for (int i = 0; i <= h+w-2; i++) {
        invFactorial[i] = power(factorial[i], MOD-2);
    }

    long long ans = 0;

    for (int i = 0; i < h-a; i++) {
        ans += factorial[b-1+i] * factorial[h+w-b-2-i] % MOD *
               invFactorial[b-1] % MOD *
               invFactorial[i] % MOD *
               invFactorial[w-b-1] % MOD *
               invFactorial[h-1-i] % MOD;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}


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

const int INF = 1<<29;

int score[1001];
int num[1001];
int rev[1001];
P bar[100001];
P p[100001];

int main(){
	int n, m, h, k;
	while(cin >> n >> m >> h >> k, n|m|h|k){
		rep(i, n) cin >> score[i];
		rep(i, n) num[i] = i;
		rep(i, m) cin >> bar[i].Y >> bar[i].X;
		sort(bar, bar+m);
		rep(i, m){
			int a = bar[i].Y;
			swap(num[a], num[a-1]);
			p[i].X = num[a], p[i].Y = num[a-1];
		}
		rep(i, n) rev[num[i]] = i;
		int normal = 0;
		rep(i, k){
			normal += score[rev[i]];
		}

		int ans = normal;
		rep(i, m){
			int res = normal;
			int a = p[i].X, b = p[i].Y;
			if(a < k) res -= score[rev[a]], res += score[rev[b]];
			if(b < k) res += score[rev[a]], res -= score[rev[b]];
			ans = min(ans, res);
		}

		cout << ans << endl;
	}

    return 0;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------
ll k;
vecll a;
bool fn(ll x){
  if(x==0) return false;
  auto target = upper_bound(all(a), x);
  ll tmp=0;
  while(target != a.end()){
    tmp += *target / x;
    target++;
  }
  if(tmp<=k) return true;
  else return false;
}

int main(void) {
  int n;
  cin >> n >> k;
  rep(i,n){
    ll tmp;
    cin >> tmp;
    a.pb(tmp);
  }
  sortall(a);

  ll mx = a[n-1];
  ll mn = 0;
  while(mx-mn>1){
    ll mid = (mn+mx)/2;
    if(fn(mid)){
      mx = mid;
    } else {
      mn = mid;
    }
  }

  prt(mx);
}


Measured memory_bytes: 5336
#include <stdio.h>
void Rect(unsigned int h, unsigned int w){
	unsigned int i, j;
	for (i = 1; i <= h; i++){
		for (j = 1; j <= w; j++){
			if (((i % 2 != 0) && (j % 2 != 0)) || ((i % 2 == 0) && (j % 2 == 0)) )
				printf("#");
			else
				printf(".");
		}
		printf("\n");
	}
	printf("\n");
}

int main(void){
	unsigned int h, w;
	while (1){
		scanf("%d %d", &h, &w);
		if (!(h * w))break;
		Rect(h, w);
	}
	return 0;
}

Measured memory_bytes: 572
for e in iter(input,'0 0'):
 r,_=map(int,e.split())
 d=[int(''.join(x),2)for x in zip(*[input().split()for _ in[0]*r])]
 a=0
 for i in range(1<<r):
  b=0
  for j in d:
   c=bin(i^j).count('1')
   b+=[r-c,c][c>r//2]
  if b>a:a=b
 print(a)


Measured memory_bytes: 6916
import java.io.*;
import java.util.*;
import java.lang.Math;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a > b)
            System.out.println("a > b");
        else if (a < b)
            System.out.println("a < b");
        else
            System.out.println("a == b");
    }
  
}


Measured memory_bytes: 26204
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(c) c.begin(),c.end()
#define PB push_back

using namespace std;
typedef long long ll;

int main()
{
  int a[3];
  int ans = 0;
  cin >> a[0] >> a[1] >> a[2];
  REP(i, 3) {
    int& x = a[i];
    int& y = a[(i + 1) % 3];
    int& z = a[(i + 2) % 3];
    if (x%2 == y%2 && y%2 != z%2) {
      x++, y++;
      ans++;
    }
  }
  sort(a, a + 3);
  ans += (a[2] - a[0]) / 2 + (a[2] - a[1]) / 2;
  cout << ans << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

ll n, w, dp[205][100005], a[205];
const ll mod = (ll)1e9 + 7;

bool cmp(ll x, ll y){
	return x > y;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> w;
for(int i = 1 ; i <= n ; ++i){
	cin >> a[i];
}
sort(a + 1, a + n + 1, cmp);
dp[0][w] = 1;
for(int i = 1 ; i <= n ; ++i){
	for(int j = 0 ; j <= w ; ++j){
		dp[i][j % a[i]] = (dp[i][j % a[i]] + dp[i - 1][j]) % mod;
		dp[i][j] = (dp[i][j] + (dp[i - 1][j] * (n - i)) % mod) % mod;
	}
}
ll sol = 0;
for(int i = 0 ; i <= w ; ++i){
	sol = (sol + (dp[n][i] * i) % mod) % mod;
}
cout << sol << endl;

return 0;
}



Measured memory_bytes: 157184
n = int(input())
s = input()
ls = list(s)
l1 = []
l2 = []
if n % 2 == 1:
    print('No')
else:
    for i in range(len(s)//2):
        l1.append(ls[i])
    for i in (range(len(s)//2, n)):
        l2.append(ls[i])
    if l1 == l2:
        print(('Yes'))
    else:
        print('No')

Measured memory_bytes: 3060
l,r = gets.split.map &:to_i
min = 2019
if l.zero? || r.zero?
  puts 0
  exit
end
(l...r).each do |i|
  (i+1..r).each do |j|
    temp = (i * j) % 2019
    if temp == 0
      min = 0
      break
    end
    min = temp if temp < min
  end
  if min.zero?
    break
  end
end
puts min

Measured memory_bytes: 1788
#include <stdio.h>

void print_exist()
{
    printf(":(\n");
}

void print_not_exist()
{
    printf("Yay!\n");
}

int main(int argc, char* aragv[])
{
    int a, b, c, d, e, k;

    if(scanf("%d", &a) != 1){
        return -1;
    }
    if(scanf("%d", &b) != 1){
        return -1;
    }
    if(scanf("%d", &c) != 1){
        return -1;
    }
    if(scanf("%d", &d) != 1){
        return -1;
    }
    if(scanf("%d", &e) != 1){
        return -1;
    }
    if(scanf("%d", &k) != 1){
        return -1;
    }

    if( e - a > k){
        print_exist();
    } else {
        print_not_exist();
    }

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define db long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 1000000007
      string s;

  int gcd(int a,int b)
  {
    if(b==0)
    {
      return a;
    }
    return gcd(b,a%b);
  }

  bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
  {

    if(a.s==b.s)
    {
      return a.f<b.f;
    }
    return a.s<b.s;
  }

  bool vis[10000][10000];

  int n;
  int currx=0,curry=0;

  void dfs(int x,int y,bool dir,int idx)
  {

    if(idx==n)
    {
      return;
    }

    currx=x;
    curry=y;

      vis[x][y]=1;
      if(s[idx]=='F')
      {
        if(dir==0)
        {
          currx++;
        }
        else
        {
          curry++;
        }

        dfs(currx,curry,dir,idx+1);
        return;
      }
      else
      {
        dfs(currx,curry,!dir,idx+1);
        dfs(currx,curry,dir,idx+1);
        
          return;
      } 

      return;
  }

  int32_t main()
  {         

      IOS

        
       
      int a,b,c,d;
      cin>>a>>b>>c>>d;
      if(a+b > c+d)
      {
        cout<<"Left";
      }
      else if(a+b == c+d)
      {
        cout<<"Balanced";
      }
      else
      {
        cout<<"Right";
      }

      return 0;
  }           

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m,ans=0;
char c[2003][2003];
vector <int> g[2003],t[2003]; 
int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++) g[i].push_back(0);
	for (int i=1;i<=m;i++) t[i].push_back(0);
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++){
		cin>>c[i][j];
		if (c[i][j]=='#'){
			g[i].push_back(j);
			t[j].push_back(i);
		}
	}
	for (int i=1;i<=n;i++) g[i].push_back(m+1);
	for (int i=1;i<=m;i++) t[i].push_back(n+1);
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (c[i][j]!='#'){
		int s1=lower_bound(g[i].begin(),g[i].end(),j)-g[i].begin(); 
		int s2=lower_bound(t[j].begin(),t[j].end(),i)-t[j].begin();
		ans=max(ans,g[i][s1]-g[i][s1-1]+t[j][s2]-t[j][s2-1]-3);
	}
	cout<<ans;
}


Measured memory_bytes: 38272
from itertools import product

n, m, x = map(int, input().split())

CA = [list(map(int, input().split())) for _ in range(n)]

ans = 10**12+1
for t in product([0,1], repeat=n): # (1, 0, 0)
    cost = 0
    understanding = [0] * m
    for i, b in enumerate(t):
        if b == 1:
            cost += CA[i][0]
            for j, a in enumerate(CA[i][1:]):
                understanding[j] += a  
    if sum(True for u in understanding if u >= x) == m:
        ans = min(ans, cost)

if ans == 10**12+1:
    print(-1)
else:
    print(ans)

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

int main() {
  std::vector<int> v(5);
  for(int i=0 ; i<5 ; i++){
    cin >> v[i];
    if(v[i] == 0){
      cout << i + 1 <<endl;
      break;
    }
  }
}


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

const int MAXR = 50;
const int MAXC = 50;
const int MOD = 1e9 + 7;
struct matrix {
    int m[MAXR][MAXC];
    int r,c;
    matrix(const matrix& o) {
        r = o.r; c = o.c;
        assert(r <= MAXR && c <= MAXC);
        foi(i,0,r) foi(j,0,c) m[i][j] = o.m[i][j];
    }
    matrix(int _r, int _c, int def) {
        r = _r; c = _c;
        assert(r <= MAXR && c <= MAXC);
        foi(i,0,r) foi(j,0,c) m[i][j] = def;
    }
    matrix(vector<vector<int>> v) {
        r = v.size(); c = v[0].size();
        assert(r <= MAXR && c <= MAXC);
        foi(i,0,r) foi(j,0,c) m[i][j] = v[i][j];
    }
    matrix operator*(const matrix& o) const {
        matrix ans(r, o.c, 0);
        foi(i,0,ans.r)foi(j,0,ans.c)foi(k,0,o.r)
            ans.m[i][j] = (ans.m[i][j] + (1LL * m[i][k] * o.m[k][j])) % MOD;
        return ans;
    }
    matrix fpow(ll exp) {
        assert(r == c);
        matrix ans(r,r,0), power(*this);
        foi(i,0,r) ans.m[i][i] = 1;
        while(exp) {
            if(exp & 1)
                ans = ans * power;
            power = power * power;
            exp >>= 1;
        }
        return ans;
    }
    friend ostream& operator << (ostream& s, matrix m) {
        foi(i,0,m.r) {
            foi(j,0,m.c)
                s << m.m[i][j] << ' ';
            s << endl;
        }
        return s;
    }};


int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int N; ll K;
    cin >> N >> K;
    matrix m(N,N,0);
    foi(i,0,N) {
        foi(j,0,N) {
            cin >> m.m[i][j];
        }
    }
    m = m.fpow(K);
    int ans = 0;
    foi(i,0,N) {
        foi(j,0,N) {
            ans = (ans + m.m[i][j]);
            if(ans >= MOD) ans -= MOD;
        }
    }
    cout << ans << '\n';
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int> h;
  h.reserve(N);
  for (int i = 0; i < N; i++) {
    int _h;
    cin >> _h;
    h.emplace_back(_h);
  }
  sort(h.begin(), h.end());
  
  int min_diff = INF;
  for (int i = 0; i + K - 1 < N; i++) {
    min_diff = min(min_diff, h[i + K - 1] - h[i]);
  }
  cout << min_diff << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 7;
const int MOD = 1e9 + 7;

deque<int> ans;

void build(ll a)
{
	if (a == 1)
		return;
	build(a >> 1);
	ans.push_back(ans.size());
	if (a & 1)
		ans.push_front(ans.size());
}


int main()
{
	ios::sync_with_stdio(false);

	ll n;
	cin >> n;
	build(n + 1);
	int sz = ans.size();
	for (int i=0; i<sz; i++)
		ans.push_back(i);
	cout << 2 * sz << "\n";
	for (int i=0; i<2*sz; i++)
		cout << ans[i]+1 << " ";
	cout << "\n";

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long b = scan.nextLong();
		long x = scan.nextLong();
		
		long count = 0;
		if(a % x == 0) {
			count = b / x - a / x + 1;
		}else {
			count = b / x - a / x;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 21844
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

constexpr int infty = 1 << 30;

int main() {
  string str;
  cin >> str;
  reverse(str.begin(), str.end());

  int N = str.size();
  str += "00";

  vector<vector<int>> m{2, vector<int>(N + 3, 0)};
  m[1][0] = infty;
  for (auto i = 0; i <= N+1; ++i) {
    // pay without change
    m[0][i + 1] = min(m[0][i] + str[i] - '0', m[1][i] + (str[i] - '0' + 1));
    // pay with change
    m[1][i + 1] =
        min(m[0][i] + 10 - (str[i] - '0'), m[1][i] + 10 - (str[i] - '0' + 1));
  }

  cout << m[0][N+1] << endl;
  return 0;
}


Measured memory_bytes: 13060
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

#define ll long long
const long long INF = 1LL << 60;
const int iINF = 1 << 20;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { 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; }

void execute();
int main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);// cin と scanfの併用禁止
    cout << fixed << setprecision(15);
    execute();
    return 0;
}


void execute()
{
    int N, K;
    cin >> N >> K;

    int have[100] = {0};

    for(int i = 0; i < K; i++){
        int d;
        cin >> d;
        for(int j = 0; j < d; j++){
            int A;
            cin >> A;
            have[A-1]++;
        }
    }

    int sum = 0;
    for(int i = 0; i < N; i++){
        if(0 == have[i]) sum++;
    }

    cout << sum << endl; 
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <limits.h>

int main(void)
{
  int n, i, currentMin, currentMaxDiff, current;
  currentMin = INT_MAX;
  currentMaxDiff = INT_MIN;
  scanf(" %d", &n);
  for (i = 0; i < n; i++)
    {
      scanf(" %d", &current);
      if (current - currentMin > currentMaxDiff)
	currentMaxDiff = current - currentMin;
      if (current < currentMin)
	currentMin = current;
    }
  printf("%d\n", currentMaxDiff);
  return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int k[5] = {5,7,5,7,7};
int n; 
string str[50];

bool dfs(int s, int c, int sum) {
    if (sum + str[s].length() == k[c]) {
        if (c == 4) return true;
        else return dfs(s+1, c+1, 0);
    }
    else if (sum + str[s].length() > k[c]) return false;
    else return dfs(s+1, c, sum + str[s].length());
}

int main(void){
    while (1) {
        cin >> n;
        if (!n) break;
        for (int i = 0; i < n; i++) cin >> str[i];
        for (int i = 0; i < n; i++) {
            int x = dfs(i, 0, 0);
            if (x == false) continue;
            cout << i+1 << endl;
            break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 100005;

int n;
int a[N];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int res = 0;
	for (int i = 1; i < n; i++) {
		if (a[i] == i && a[i + 1] == i + 1) {
			swap(a[i], a[i + 1]);
			res++;
		}
	}
	for (int i = 1; i < n; i++) {
		if (a[i] == i || a[i + 1] == i + 1) {
			swap(a[i], a[i + 1]);
			res++;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
 
int main(){
    char ch;
    while((ch = getchar()) != EOF){
            if(ch >= 97 && ch <= 122)
                printf("%c",ch-32);
            else if(ch >= 65 && ch <= 90)
                printf("%c",ch+32);
            else
                printf("%c",ch);
    }
}


Measured memory_bytes: 2532
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int n = Integer.parseInt(scanner.nextLine());

		String[] temp = scanner.nextLine().split(" ");
		int[] list = new int[n];
		double ans = 0;
		for(int i = 0; i < n; i++) {

			list[i] = Integer.parseInt(temp[i]);
			ans += 1.0 / list[i];
		}


		ans = 1 / ans;

		System.out.println(ans);







	}



}


Measured memory_bytes: 21844
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define re register
#define file(a) freopen(a".in",,"r",stdin);freopen(a".out","w",stdout)
#define int ll
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	return f*sum;
}
int a,b;
signed main(){
	a=gi();b=gi();
	if(a<=0 && b>=0)puts("Zero");
	else if(a>0)puts("Positive");
	else if(abs(a-b+1)%2)puts("Negative");
	else puts("Positive");
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct node{
  int key;
  struct node *r,*l,*par;
}Node;

Node *root,*NIL;

void insert(int k){
  Node *y=NIL;
  Node *x=root;
  Node *z;

  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->l=NIL;
  z->r=NIL;
  while(x!=NIL){
    y=x;
    if(z->key<x->key){
      x=x->l;
    }
    else{
      x=x->r;
    }
  }

  z->par=y;
  if(y==NIL){
    root=z;
  }
  else{
    if(z->key<y->key){
      y->l=z;
    }
    else{
      y->r=z;
    }
  }
}

void inorder(Node *u){
  if(u==NIL)return;
  inorder(u->l);
  printf(" %d",u->key);
  inorder(u->r);
}

void preorder(Node *u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->l);
  preorder(u->r);
}

int main(){
  int n,i,a;
  char ary[10];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",ary);
    
    if(strcmp(ary,"insert")==0){
      scanf("%d",&a);
      insert(a);
    }
    else if(strcmp(ary,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}
  



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

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	int sum = 0;
	for (int i = 0; i < n; ++i) {
		cin >> v[i];
		sum += v[i];
	}
	sort(v.rbegin(),v.rend());
	if (v[0] < sum - v[0]) {
		cout << "Yes";
	}else {
		cout << "No";
	}
}


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

int main(){
  string n;
  ll kazu=0;
  cin>>n;
  if(n.size()==3){
    kazu=n[2];
  }
  else if(n.size()==2){
    kazu=n[1];
  }
  else{
    kazu=n[0];
  }
  if(kazu=='3'){
    cout<<"bon"<<endl;
  }
  else if(kazu=='0'||kazu=='1'||kazu=='6'||kazu=='8'){
    cout<<"pon"<<endl;
  }
  else{
    cout<<"hon"<<endl;
  }
}

Measured memory_bytes: 3620
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n;
    cin >> n;
    map<int,int>mp;
    rep(i,n){
        int x;
        cin >> x;
        mp[x]++;
    }
    int ans = 0;
    for(auto x:mp){
//        cerr << x.first << " " <<x.second << endl;
        if(x.first != x.second){
            if(x.second < x.first) ans += x.second;
            else ans += x.second-x.first;
//            show(ans);
        }
    }
    cout << ans << endl;
}

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

int main()
{
    int N, M;
    string s;
    map<string, int> m;
    
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> s;
        m[s]++;
    }
    cin >> M;
    for (int i = 0; i < M; i++) {
        cin >> s;
        m[s]--;
    }
    
    int ans = 0;
    for (auto i = m.begin(); i != m.end(); i++) {
        ans = max(i->second, ans);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
<?php

$input=trim(fgets(STDIN));

$array_card=array();
$array_data=array();

for($i=1;$i<=13;$i++){

	$array_card["S"][$i]=0;
	$array_card["H"][$i]=0;
	$array_card["C"][$i]=0;
	$array_card["D"][$i]=0;

}


while($input<>""){

	$array_data[]=$input;

	$input=trim(fgets(STDIN));

}

// print_R($array_data);

for($i=1;$i<=$array_data[0];$i++){

	CardCheck($array_data[$i],$array_card);
}

// print_r($array_card);

foreach($array_card as $k=>$v){

	// print $k;
	// print $v;

	for($j=1;$j<=13;$j++){

		if($v[$j]==0){

			printf("%s %d\n",$k,$j);
		}

	}
}

function CardCheck($str,&$array_card){

	$array_temp=explode(" ", $str);

	$mark=$array_temp[0];
	$number=$array_temp[1];


	$array_card[$mark][$number]=1;

	// print_r($array_temp);

	// print $mark;
	// print $number;

}

Measured memory_bytes: 15520
#include <algorithm>
#include <iostream>
#include <queue>

int main()
{
	int n = 0;
	int k = 0;
	std::cin >> n >> k;

	long long curSum = 0;
	std::queue<int> pQ;

	for (int index = 0; index < k; ++index)
	{
		int p = 0;
		std::cin >> p;
		curSum += p;
		pQ.emplace(p);
	}

	long long maxSum = curSum;
	for (int index = k; index < n; ++index)
	{
		int p = 0;
		std::cin >> p;
		curSum += p;
		curSum -= pQ.front();
		maxSum = std::max(curSum, maxSum);
		pQ.pop();
		pQ.emplace(p);
	}

	printf("%f", (k + maxSum) / 2.0);
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
#define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


void print_vector(vector<int> v) {
    rep(i, v.size()) {
        if(!i)cout<<v[i];
        else cout<<" "<<v[i];
    }
    cout<<endl;
}

int main() {

    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    vi bef=v;
    vi af=v;
    bool bb = prev_permutation(all(bef));
    bool bn = next_permutation(all(af));
    if(bb)print_vector(bef);
    print_vector(v);
    if(bn)print_vector(af);
}




Measured memory_bytes: 3172
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

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

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

  if(r<1200)cout<<"ABC"<<endl;
  else if(r<2800)cout<<"ARC"<<endl;
  else cout<<"AGC"<<endl;

  return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  int a[N];
  for(int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a,a+N);
  double Max = 0;
  for(int i = 0; i < N-1; i++) {
    int tmp1 = a[i+1] - a[i];
    int tmp2 = 0;
    if(i == N - 2) {
      tmp2 = a[i-1] + a[i-2];
    } else if(i == N - 3) {
      tmp2 = a[N-1] + a[i-1];
    } else {
      tmp2 = a[N-1] + a[N-2];
    }
    Max = max((double)tmp2 / tmp1,Max);
  }
  printf("%.10lf\n",Max);
}

Measured memory_bytes: 3232
n,k = map(int, input().split())

#############

mod = 10**9 + 7
max = n + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max

def comInit(max):
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,max):
      fac[i] = fac[i-1]* i% mod
      inv[i] = mod - inv[mod%i] * (mod // i) % mod
      finv[i] = finv[i-1] * inv[i] % mod

comInit(max)

# 二項係数の計算
def com(n,k):
    if(n < k):
        return 0
    if( n<0 | k < 0):
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod

#############

for i in range(1,k+1):
    if( n-k < i -1 ):
        print(0)
        continue
    ans = com(k-1, i-1) * com( n-k+1, i ) % mod
    print(ans)

Measured memory_bytes: 42608
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


ll gcd(ll x,ll y){
  return y==0? x:gcd(y,x%y);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;cin>>S;
  bool isok=true;
  int flg=0;
  repeat(i,S.length()){
    isok &= !((flg>>(S[i]-'A'))&1);
    flg |= 1<<(S[i]-'A');
  }
  cout <<(isok? "yes":"no")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

int main() {
  int N, K; cin >> N >> K;
  vector<int> h(N); cin >> h;
  int cnt = 0;
  for (int x : h) {
    if (x >= K) ++cnt;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3696
import java.util.Scanner;

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

		// 整数の入力
		int h1 = sc.nextInt();
		int m1 = sc.nextInt();
		int h2 = sc.nextInt();
		int m2 = sc.nextInt();
		int k = sc.nextInt();
		
		System.out.println((h2-h1-1)*60+(60-m1)+m2-k);

        sc.close();
	}
}

Measured memory_bytes: 35752
/* ex3_4
   offNaria */
#include <stdio.h>

int main(void){
  int input, judge; //整数input,judgeを定義
  judge = 0;
  scanf("%d", &input); //入力を変数に代入
  for(int counter1 = 1; counter1 < 10; counter1++){
    for (int counter2 = 1; counter2 < 10; counter2++)
    {
      if(input == counter1 * counter2){
        judge = 1;
        break;
      }
    }
  }
  if(judge == 1){
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

int main(void) {
    int num, time;
    cin >> num >> time;
    vector<int> arr(num);
    cins(arr);
    int64_t ans = 0;
    int rem = 0;
    int prev = 0;
    for(int i = 0; i < num; i++) {
        int cur = arr[i];
        // in i = 0, rem = time, which means last person does shower.
        rem = max(0, rem-(cur-prev));
        debug("%lld\n", time-rem);
        ans += (time - rem);
        // update
        rem = time;
        prev = cur;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char *argv[]) {
  vector<int> topping;
  int n, t, price;
  double calory;
  cin >> n;
  cin >> price >> t;
  cin >> calory;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    topping.push_back(tmp);
  }

  sort(topping.rbegin(), topping.rend());
  for (int i = 0; i < n; i++) {
    double after = (calory + topping[i]) / (price + t);
    if (after > calory / price) {
      calory += topping[i];
      price += t;
    } else {
      break;
    }
  }

  cout << floor(calory / price) << endl;
  return 0;
}

Measured memory_bytes: 1312
//#include <atcoder/modint>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
typedef long long ll;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
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; }
const int INF = 2e9;
const ll LINF = (1LL<<60);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  vector<ll> sums;
  REP(i,n){
    ll sum = 0;
    FOR(j,i,n){
      sum += a[j];
      sums.push_back(sum);
    }
  }
  
  ll mx = *max_element(ALL(sums));
  int high = int(log2(mx));
  ll ans = 0LL;
  REPR(bit,high){
    vector<ll> tmp;
   	for(auto x: sums){
      if(x & (1LL<<bit)) tmp.push_back(x);
    }
    if(SIZE(tmp)>=k){
      ans |= (1LL<<bit);
      sums = tmp;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9148
import sys
from itertools import accumulate
from collections import Counter

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = map(int, input().split())
    A = list(map(int, input().split()))

    R = [0] + list(accumulate(A))
    R_mod = [r % m for r in R]

    D = Counter(R_mod)
    res = 0
    for v in D.values():
        res += (v - 1) * v // 2
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 25720
n = int(input())
s = input()
ans = 0

for i in range(1000):
        i = '0' * (3 - len(str(i))) + str(i)
        keep = 0

        for j in range(n):
                if s[j] == i[keep]:
                        keep += 1
                if keep == 3:
                        ans += 1
                        break

print(ans)


Measured memory_bytes: 73712
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	ns := float64(n)
	cnt := 0.0
	for i := 1; i <= n; i++ {
		if i%2 != 0 {
			cnt++
		}
	}
	fmt.Println(cnt / ns)
}


Measured memory_bytes: 512
import java.util.*;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Set<String> set = new HashSet<String>();
        for (int i =0; i<n;i++){
            set.add(sc.next());
        }
        set.removeIf(s -> s.equals(""));
        System.out.println(set.size());
        }
    }


Measured memory_bytes: 78388
from collections import defaultdict
INF = 10 ** 15
N = int(input())
A = list(map(int,input().split()))
dp_take = defaultdict(lambda: -INF)
dp_not = defaultdict(lambda: -INF)
dp_take[(0,0)] = 0
dp_not[(0,0)] = 0

for i in range(N):
    for j in range((i + 1) // 2 - 1, (i + 2) // 2 + 1):
        if j > 0:
            dp_take[(i+1, j)] = max(dp_take[(i+1, j)], dp_not[(i, j-1)] + A[i])
        dp_not[(i+1, j)] = max(dp_not[(i, j)], dp_take[(i, j)])

print(max(dp_take[(N, N//2)], dp_not[(N, N//2)]))

Measured memory_bytes: 239368
#include<stdio.h>

int main(void)
{
  int d,n;
  scanf("%d%d",&d,&n);

  int h=100;

  if(d!=0){
  for(int i=0; i<d-1; i++){
    h *= 100;
    }
    if(n==100){
    printf("%d",101*h);
    return 0;
    }
  }else{
    if(n==100){
      printf("%d",101);
      return 0;
    }
    printf("%d",n);
    return 0;
  }
    printf("%d",h*n);

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << '\n'
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
  string s;
  cin >> s;
  int ans = 0;
  for (char c: s) if (c=='1') ans++;
  pr(ans);
  return 0;
}

Measured memory_bytes: 3584
N = int(input())
A = [int(i) for i in input().split()]
A_dict = dict()
for i in A:
    if i in A_dict:
        A_dict[i] += 1
    else:
        A_dict[i] = 1
A_ordered = sorted([i for i in A_dict if A_dict[i] >=2], reverse = True)
candidate_ans = [0]
if len(A_ordered) >= 2:
    candidate_ans.append(A_ordered[0] * A_ordered[1])
for i in A_ordered:
    if A_dict[i] >= 4:
        candidate_ans.append(i ** 2)
        break
print(max(candidate_ans))

Measured memory_bytes: 18060