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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, VL, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

string S;
string choice[4] = {"resare", "esare", "remaerd", "maerd"};

signed main() {
    cin >> S;
    reverse(All(S));
    string ans;
    ll idx = 0;
    while(ans.length() < S.length()) {
        REP(i, 4) {
            ll len = choice[i].length();
            string s = S.substr(idx, len);
            if(s == choice[i]) {
                reverse(All(s));
                ans = s + ans;
                idx += len;
                break;
            }
            if(i == 3) {
                cout << "NO"
                     << "\n";
                return 0;
            }
        }
    }
    cout << "YES"
         << "\n";
    return 0;
}


Measured memory_bytes: 512
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)       for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
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); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/

bool isPrime(int n){
    if(n < 2) return false; else if(n == 2) return true; else if(n%2 == 0) return false;
    double sqrtNum = sqrt(n); for(int i = 3;i <= sqrtNum; i += 2) if(n%i == 0) return false;
    return true;
    }

/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int x; cin >> x;
    for(int i = 0;;++i){
        if(isPrime(x + i)){
            cout << x + i << endl;
            return 0;
        }
    }

}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i=a; i<b; i++)

using namespace std;

typedef long long ll;

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

  map<ll, int> m;
  
  int n;
  cin >> n;
  rep(i, 0, n){
    ll a;
    cin >> a;
    m[a]++;
  }

  ll sq = -1;
  vector<ll> v;
  for(auto p: m){
    if( p.second >= 2 )
      v.push_back(p.first);
    if( p.second >= 4 )
      sq = max(sq, p.first);
  }

  if( v.size() < 2 ){ // No rectangle possible
    if( sq != -1 ) // But square possible
      cout << sq*sq << endl;
    else
      cout << 0 << endl;
  }else{
    n = v.size();
    ll reca = v[n-1]*v[n-2];

    if( reca > sq*sq )
      cout << reca << endl;
    else
      cout << sq*sq << endl;
  }
  

  return 0;
}

// AC
/*
  Let a and b the sides of a rectangle. Then
  Area = a*b < a*(b+e) = a*b + a*e, e > 0
  
  Therefore increasing the length of one side, increase the area. Greedy approach.

  To build a rectangle with diferent length sides, we need two a_i such that their frecuency is at least 2.
  To build a rectangle with equal length sides (a square), the frecuency must be at least 4.

  For each case, maximize the area. Choose the greater between them.
 */


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

using namespace std;

bool lexicographicalSmaller(vector<int> a, vector<int> b)
{
    int n = a.size();
    int m = b.size();
    for(int i = 0; i < n && i < m; i++)
    {
        if(a[i] < b[i]) return true;
        else if(b[i] < a[i])    return false;
        return i == n && i < m;
    }
}

int main()
{
	int m, n;
	cin >> m >> n;
	vector<int> a, b;
	for(int i=0;i<m;i++)
	{
		a.push_back(n);
	}
	for(int i=0;i<n;i++)
	{
		b.push_back(m);
	}
	if(lexicographicalSmaller(a, b))
	{
		for(auto it=a.begin();it!=a.end();it++)
			cout << *it;		
	}
	else
	{
		for(auto it=b.begin();it!=b.end();it++)
			cout << *it;
	}
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REP(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define REP1(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Int = long long;

//INT_MAX = 2147483647;
//LLONG_MAX = 9223372036854775807;
//ULLONG_MAX = 18446744073709551615;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n;
    cin >> n;
    vector<int> w(n);
    rep(i,n) cin >> w[i];
    int l=0,r=n-1;
    int s1=0,s2=0;
    vector<int> p(n);
    p[0] = w[0];
    rep1(i,1,n){
        p[i] += p[i-1]+w[i];
    }
    int min_ = inf;
    rep(i,n){
        min_ = min(min_,abs(p[n-1]-2*p[i]));
    }
    cout << min_<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 201001;
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    char a, b, c;
    cin >> a >> b >> c;
    if (a == '7' || b == '7' || c == '7') {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

}


Measured memory_bytes: 3652
import numpy as np
from itertools import product
from itertools import combinations

def resolve():
  H, W, K = map(int, input().split(" "))
  tasksH = []
  tasksH.append([])
  rangeH = range(H)
  for h in rangeH:
    tasksH.extend([list(x) for x in combinations(rangeH, h + 1)])

  tasksW = []
  tasksW.append([])
  rangeW = range(W)
  for w in rangeW:
    tasksW.extend([list(x) for x in combinations(rangeW, w + 1)])


  tasks = [list(x) for x in product(tasksH, tasksW)]

  C = []
  for h in range(H):
    C.append([x == "#" for x in list(input()) ])
  C = np.array(C)

  result = 0
  for task in tasks:
    if np.sum(C[np.ix_(task[0], task[1])]) == K:
      result += 1
  print(result)

if __name__ == "__main__":
  resolve()

Measured memory_bytes: 27540
#include<bits/stdc++.h>
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000001
#define MAXN        400005
#define mod         1000000007
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,a,b;
    cin>>n>>a>>b;
    n=min(n*a,b);
    cout<<n;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
int dp[100001];
int main() {
	int n, k, k2;
	cin >> n;
	rep(i, 0, 100001) {
		if (i)dp[i] = dp[i - 1] + 1;
		k = 1;
		rep(i2, 0, 10000) {
			k *= 6;
			if (i - k >= 0)dp[i] = min(dp[i - k] + 1, dp[i]);
			else break;
		}
		k = 1;
		rep(i2, 0, 10000) {
			k *= 9;
			if (i - k >= 0)dp[i] = min(dp[i - k] + 1, dp[i]);
			else break;
		}
	}
	printf("%d\n", dp[n]);
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main()
{
	int flag = 0;
	string s;
	cin >> s;
	for (int i = 0; i<s.size() - 1; i++){
		if (s[i] == s[i + 1]){
			printf("%d %d\n", i + 1, i + 2);
			flag = 1;
			break;
		}
		else if (i<s.size() - 2 && s[i] == s[i + 2]){
			printf("%d %d\n", i + 1, i + 3);
			flag = 1;
			break;
		}
	}
	if (!flag)
		printf("-1 -1\n");
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define FINISH cout<<"NO"<<endl;return 0
using ll = long long;
const ll MOD = 1000000007;

map<ll, ll> sa, st;
bool mp;
vector<pair<ll, ll>> V[2], Vsb;
ll R[3400010];

void zrk(ll d, ll p, ll n, ll k, ll low, ll up) {
	if (d == 0) {
		V[mp].push_back({ n,p });
		return;
	}
	if (k == 0) {
		V[mp].push_back({ n, p * 10 });
		return;
	}
	//cout << d << " " << p << " " << n << " " << k << " " << low << " " << up << endl;
	for (auto s : sa)
		zrk(d - 1, p * s.second, n + k * s.first, low / 10 - up * 10, low / 10, up * 10);
}

void zrkf(ll d, ll p, ll n, ll k, ll low, ll up) {
	if (d == 0) {
		V[mp].push_back({ n,p });
		return;
	}
	//cout << d << "f" << p << "f" << n << " " << k << " " << low << " " << up << endl;
	for (auto s : st)
		zrk(d - 1, p * s.second, n + k * s.first, low / 10 - up * 10, low / 10, up * 10);
}

int main() {
	for (int i = 0;i < 10;i++) {
		for (int j = 0;j < 10;j++) {
			if (sa.count(i - j))sa[i - j]++;
			else sa.insert({ i - j,1 });
			if (j > 0 && i >= j) {
				if (st.count(i - j))st[i - j]++;
				else st.insert({ i - j,1 });
			}
		}
	}

	int D;
	cin >> D;
	
	ll r9, r10, r1, vs0, vs1, s0, s1;

	map<ll, ll> M, NM;

	ll ans = 0;
	for (int i = 2;i < 19;i++) {
		r9 = 9, r10 = 10;
		for (int j = 2;j < i;j++) {
			r9 *= 10;
			r9 += 9;
			r10 *= 10;
		}

		ll ser = (i + 1) / 2;
		r1 = 1;
		mp = 0;
		zrkf(ser - ser / 2, 1, 0, r9, r10, 1);

		//cout << ser - ser / 2 << " " << r10 << " " << r1 << endl;
		for (int j = 0;j < ser - ser / 2;j++)r10 /= 10, r1 *= 10;
		//cout <<  ser / 2 << " " << r10 << " " << r1 << endl;

		mp = 1;
		zrk(ser / 2, 1, 0, r10 - r1, r10, r1);

		sort(all(V[0]));
		sort(all(V[1]));
		
		vs0 = V[0].size();
		vs1 = V[1].size();
		R[0] = 0;
		for (int j = 1;j <= vs1;j++)
			R[j] = R[j - 1] + V[1][j - 1].second;

		pair<ll, ll> sr;
		for (int j = 0;j < vs0;j++) {
			sr = { D - V[0][j].first,LLONG_MIN };
			auto it = lower_bound(all(V[1]), sr);

			sr.first++;
			auto it2 = lower_bound(all(V[1]), sr);

			s0 = it - V[1].begin();
			s1 = it2 - V[1].begin();
			ans += (R[s1] - R[s0]) * V[0][j].second;
		}
		for (int j = 0;j <= vs1;j++) {
			R[j] = 0;
		}
		V[0] = Vsb;
		V[1] = Vsb;
	}
	cout << ans << endl;
}

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

using ll = long long int;
using vi = vector<int>;
using vll = vector<long long int>;
using vii = vector<vi>;
using pii = pair<int, int>;

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i, a, b) for(int (i) = a; (i) < (b);(i)++)
#define MAX(a, b) ((a > b) ? a : b)
#define MIN(a, b) ((a > b) ? b : a)

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int MOD = 1e9 + 7;


int main(){
  string s;
  cin >> s;
  if(s.size() == 3) reverse(s.begin(), s.end());
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.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)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  ll n,k;
  cin>>n>>k;
  ll x=n-n/k*k;
  cout<<min(x,llabs(x-k))<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define INF 100000000001

int main(){
    LL n;
    cin >> n;
    map<LL,LL> l;
    map<LL,LL> num[10];
    map<LL,LL> ans[10];

    for(LL i = 0; i < 3; i++){
        for(LL j = 0; j < n; j++){
            LL b;
            cin >> b;
            l[b] = 1;
            num[i][b]++;
        }
    }
    l[0] = l[INF] = 1;
    num[3][INF] = 1;
    ans[0][0] = 1;

    for(LL i = 1; i <= 4; i++){
        LL cur = 0;
        for(map<LL,LL>::iterator it = l.begin(); it != l.end(); it++){
            LL c = it->first;
            ans[i][c] = cur * num[i-1][c];
            //cout << i << " " << c << " " << ans[i][c] << endl;
            cur += ans[i-1][c];
        }
    }
    cout << ans[4][INF] << endl;
}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

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

long long 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;
}
ll dp[110][8];
const int mod = 1e9+7;
int main()
{
	COMinit();
	ll h, w, k;
	cin >> h >> w >> k;
	--k; // 0-indexedにしてもろて
	dp[0][0] = 1;
	for(int tate = 1; tate <= h; tate++){
		for(ll tmp = 0; tmp < (1 << (w-1)); tmp++){
			bitset<8> bit(tmp);
			debug(bit);
			// まず、1が2つ連続で並んでたらダメ。
			bool ok = true;
			For(i,1,w-1){
				if(bit.test(i) && bit.test(i-1)){
					// ダメ
					//cout << "dame" << endl;
					ok = false;
				}
			}
			if(ok){ 
				vector<bool> check(w+1,false);
				rep(i,w-1){
					if(bit.test(i)){
						dp[tate][i+1] += dp[tate-1][i];
						dp[tate][i] += dp[tate-1][i+1];
						dp[tate][i+1] %= mod;
						dp[tate][i]   %= mod;

						check[i] = true;
						check[i+1] = true;
					} 
				}
				rep(i,w){
					if(!check[i]){
						dp[tate][i] += dp[tate-1][i];
						dp[tate][i] %= mod;
					}
				}
			}
		}
	}
	cout << dp[h][k] << endl;
}


Measured memory_bytes: 15564
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeMap;

public class Main {
    static final long MOD = 998244353;

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(in.readLine());
        Robot[] robots = new Robot[n];
        for (int j = 0; j < n; j++) {
            String line = in.readLine();
            int six = line.indexOf(' ');
            robots[j] = new Robot(Integer.parseInt(line.substring(0, six)), Integer.parseInt(line.substring(six + 1)));
        }
        Arrays.sort(robots, Comparator.comparingInt(robot -> robot.x));
        TreeMap<Integer, Integer> treeMap = new TreeMap<>();
        SegmentTree segTree = new SegmentTree(0, n - 1);
        treeMap.put(Integer.MAX_VALUE, n);
        long[] sums = new long[n + 1];
        sums[n] = 1;
        for (int j = n - 1; j >= 0; j--) {
            sums[j] = sums[j + 1];
            int k = treeMap.ceilingEntry(robots[j].x + robots[j].d).getValue();
            segTree.update(j, k);
            //System.out.println("j = " + j + ", k = " + k);
            k = segTree.query(j, k - 1);
            //System.out.println("j = " + j + ", k = " + k);
            segTree.update(j, k);
            sums[j] += sums[k];
            sums[j] %= MOD;
            treeMap.put(robots[j].x, j);
        }
        System.out.println(sums[0]);
    }

    static class Robot {
        final int x;
        final int d;

        Robot(int x, int d) {
            this.x = x;
            this.d = d;
        }
    }

    static class SegmentTree {
        final int[] val;
        final int treeFrom;
        final int length;

        SegmentTree(int treeFrom, int treeTo) {
            this.treeFrom = treeFrom;
            int length = treeTo - treeFrom + 1;
            int l;
            for (l = 0; (1 << l) < length; l++);
            val = new int[1 << (l + 1)];
            this.length = 1 << l;
        }

        void update(int index, int delta) {
            int node = index - treeFrom + length;
            val[node] = delta;
            for (node >>= 1; node > 0; node >>= 1) {
                val[node] = Math.max(val[node << 1], val[(node << 1) + 1]);
            }
        }

        int query(int from, int to) {
            if (to < from) {
                return 0;
            }
            from += length - treeFrom;
            to += length - treeFrom + 1;
            int res = 0;
            for (; from + (from & -from) <= to; from += from & -from) {
                res = Math.max(res, val[from / (from & -from)]);
            }
            for (; to - (to & -to) >= from; to -= to & -to) {
                res = Math.max(res, val[(to - (to & -to)) / (to & -to)]);
            }
            return res;
        }
    }
}



Measured memory_bytes: 79136
#include"bits/stdc++.h"

using namespace std;

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

	vector<int>B(M);
	vector<vector<int>> A(N, vector<int>(M));

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

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

	int ans = 0;
	for (int i = 0; i < N; i++) {
		int sum = 0;
		for (int j = 0; j < M; j++) {
			sum += A[i][j] * B[j];
		}
		if (sum + C > 0) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
import math
import bisect

def solve(A):
    n = len(A)
    m = len(A[0])
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            val = 0
            for k in range(m):
                val += (A[i][k] - A[j][k]) ** 2
            dval = math.sqrt(val)
            if dval == math.floor(dval):
                ans += 1
    return ans

def main():
    n, m = map(int, input().split())
    A = []
    for i in range(n):
        A.append(list(map(int, input().split())))
    print(solve(A))

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
   int n;
   double m;
   cin>>n;
   for(int i=n;i>=1;i--){
        m=pow(i,float(0.5));
        if(double(m-int(m))==0){
            cout<<i;
        break;
        }
   }
 return 0;
}


Measured memory_bytes: 4204
import java.util.Scanner;

public class Main {
	private static int n = 0;
	private static int ans = 0;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		sc.close();

		dfs("0");
		System.out.println(ans);
	}

	private static void dfs(String val) {
		if (Long.parseLong(val) > n) {
			return;
		}
		if (val.indexOf("3") != -1 && val.indexOf("5") != -1 && val.indexOf("7") != -1) {
			ans++;
		}

		dfs(val + "3");
		dfs(val + "5");
		dfs(val + "7");
	}
}


Measured memory_bytes: 36436
#include<stdio.h>

int main(void)
{
   int h, w, i, f;
   char a[101][101];

   scanf("%d%d",&h,&w);
   for(i=0;i<h;i++)
      scanf("%s",&a[i]);

   for(i=0;i<w+2;i++)
      printf("#");
   printf("\n");
   for(i=0;i<h;i++)
      printf("#%s#\n",a[i]);
   for(i=0;i<w+2;i++)
      printf("#");
   printf("\n");
   return 0;
}

Measured memory_bytes: 1712
a,b,C = map(float,input().split())
import math
C=math.radians(C)
S=(1/2)*a*b*math.sin(C)
c=math.sqrt(a**2+b**2-2*a*b*math.cos(C))
L=a+b+c
h=2*S/a

print(f'{S:.08f}')
print(f'{L:.08f}')
print(f'{h:.08f}')


Measured memory_bytes: 5704
S = str(input())
Sarray = list(S)
for i in range(len(Sarray)):
    Sarray[i] = int(Sarray[i])

count = [0] * 2
for i in range(2):
    if i == 1:
        if Sarray[0] == 1:
            Sarray[0] = 0
        else:
            Sarray[0] = 1
    
    for j in range(1,len(Sarray)):
        if Sarray[j] == Sarray[j-1]:
            count[i] += 1
            if Sarray[j] == 1:
                Sarray[j] = 0
            else:
                Sarray[j] = 1

count.sort

print(count[0])

Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N;
  cin>>N;
  vector<ll>data(N);
  for(ll i=0;i<N;i++)cin>>data[i];
  reverse(data.begin(),data.end());
  ll cnt=0;
  ll ans=0;
  for(ll i=1;i<N;i++){
    if(data[i]>=data[i-1])cnt++;
    else{
      cnt=0;
    }
    ans=max(ans,cnt);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)

#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)

int main(){
  ll a,b;
  string u;
  char c;
  ll n;
  cin >> n;
  double x,y=0;
  rep(i,n){
    cin >>x >> u;
    if(u=="JPY")y+=x;
    else{
      y+=x*380000;
    }
  }
  cout << y <<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<array>

int main(){

    constexpr std::array<int8_t, 8> dx = {-1, 0, 1, 1, 1, 0, -1, -1};
    constexpr std::array<int8_t, 8> dy = {1, 1, 1, 0, -1, -1, -1, 0};
    
    size_t h, w;

    std::cin >> h >> w;

    std::vector<std::vector<char>> mat(h, std::vector<char>(w));

    for(size_t i = 0; i < h; i++){
        for(size_t j = 0; j < w; j++){
            std::cin >> mat[i][j];
        }
    }

    for(size_t i = 0; i < h; i++){
        for(size_t j = 0; j < w; j++){
            if(mat[i][j] == '#') continue;

            size_t cnt = 0;

            for(size_t k = 0; k < 8; k++){
                const int8_t tx = static_cast<int8_t>(j) + dx[k];
                const int8_t ty = static_cast<int8_t>(i) + dy[k];
                if(tx < 0 || tx >= static_cast<int8_t>(w)) continue;
                if(ty < 0 || ty >= static_cast<int8_t>(h)) continue;

                if(mat.at(ty).at(tx) == '#') cnt++;
            }

            mat[i][j] = '0' + cnt;
        }
    }

    for(const auto& v : mat){
        for(const auto& e : v){
            std::cout << e;
        }std::cout << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    const int inf = 100000000;

    int n, m;
    cin >> n >> m;

    int a[1000], b[1000], c[1000], dist[100][100];

    for (int i = 0; i < m; ++i) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--, b[i]--;
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (i == j)
                dist[i][j] = 0;
            else
                dist[i][j] = inf;
        }
    }

    for (int i = 0; i < m; ++i) {
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }

    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ans = m;
    for (int i = 0; i < m; ++i) {
        bool shortest = false;
        for (int j = 0; j < n; ++j) if (dist[j][a[i]] + c[i] == dist[j][b[i]]) shortest = true;
        if (shortest == true) {
            ans = ans - 1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    A = nl()
    mod = 10 ** 9 + 7
    s = sum(A)
    q = sum([a ** 2 for a in A])
    ans = (((s * s) - q)) // 2
    print(int(ans % mod))


if __name__ == '__main__':
    main()


Measured memory_bytes: 107056
import java.io.PrintWriter
import java.util.*

val pw = PrintWriter(System.out)
val sc = Scanner(System.`in`)

fun main(args: Array<String>) {
    val n = nextInt()
    val nn = n%10
    val hon = listOf<Int>(2,4,5,7,9)
    val pon = listOf<Int>(0,1,6,8)
    for(i in hon){
        if(nn == i) println("hon")
    }
    for(i in pon){
        if(nn == i) println("pon")
    }
    if(nn == 3) println("bon")
}

fun abc000a() {

}


fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



Measured memory_bytes: 40320
#include <iostream>
#include <cmath>
#include <list>
using namespace std;

int main() {
    int n, c, x;
    list<int> lst;
    auto itr = lst.begin();
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> c;
        if(c == 0) {
            cin >> x;
            itr = lst.insert(itr, x);
        } else if(c == 1) {
            cin >> x;
            for(int i = 0; i < abs(x); ++i) {
                if(x > 0) {
                    itr++;
                } else {
                    itr--;
                }
            }  
        } else {
            itr = lst.erase(itr);
        }
    }
    for(auto itr = lst.begin(); itr != lst.end(); ++itr) {
        std::cout << *itr << "\n";
    }
}



Measured memory_bytes: 18532
#include <iostream>
#include <cstdio>
#include <cmath>
#include <complex>
using namespace std;

typedef complex<double> P;
#define PI 3.14159265358979
#define EPS (1e-10)
#define X real()
#define Y imag()

class Triangle{
  private:
    P a, b, c;
    double edgeA, edgeB, edgeC;
    double angleA, angleB, angleC;
    
    double LawOfCosines(double a, double b, double c){
      return acos((b*b + c*c - a*a) / (2.0*b*c));
    }
    
    bool equal(double a, double b){
      return (abs(a - b) < EPS) ? true : false;
    }
  
  public:
    Triangle(P p1, P p2, P p3){
      a = p1; b = p2; c = p3;
      edgeB = abs(c - a);
      edgeC = abs(a - b);
      edgeA = abs(b - c);
      angleA = LawOfCosines(edgeA, edgeB, edgeC);
      angleB = LawOfCosines(edgeB, edgeC, edgeA);
      angleC = LawOfCosines(edgeC, edgeA, edgeB);
    }
    
    double circumscribedCircleRedius(){
      return (edgeA / sin(angleA) / 2.0);
    }
    
    double circumscribedCircleX(){
      double A = sin(2.0*angleA);
      double B = sin(2.0*angleB);
      double C = sin(2.0*angleC);
      return ((a.X*A + b.X*B + c.X*C) / (A + B + C));
    }
    
    double circumscribedCircleY(){
      double A = sin(2.0*angleA);
      double B = sin(2.0*angleB);
      double C = sin(2.0*angleC);
      return ((a.Y*A + b.Y*B + c.Y*C) / (A + B + C));
    }
};

int main(void){
  int n;
  double x1, x2, x3, y1, y2, y3;
  double r, xp, yp;

  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    P a(x1, y1);
    P b(x2, y2);
    P c(x3, y3);
    Triangle Tr(a, b, c);
    r = Tr.circumscribedCircleRedius();
    xp = Tr.circumscribedCircleX();
    yp = Tr.circumscribedCircleY();
    printf("%.3lf %.3lf %.3lf\n", xp, yp, r);
  }
  return 0;
}

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


int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    long test=1;
// 	cin>>test;	
	while(test--)
	{
	    long long a,b=0,c=0,k,i,n,j,mini,maxi,ans,q,sum,x,y,count=0,next,prev,n1,n2;
	   
	   // string s1,s2,s3;
	    cin>>a>>b>>n;
	    i=a;
	    long long r1=a%n;
	    long long r2=b%n;
	    if(r1!=0)
	    a=a+n-r1;
	    b=b-r2;
	    n1=a/n;
	    n2=b/n;
	    cout<<max((long long)(0),n2-n1+1);
	
    }
    
}


Measured memory_bytes: 256
import numpy as np

N, K = map(int, input().split())
X = np.zeros(N, np.bool)
for _ in range(K):
    d = int(input())
    Z = [int(i) for i in input().split()]
    for z in Z:
        X[z - 1] = True
print(N - np.count_nonzero(X))


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

const int mod = 1e9 + 7;

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> vs = { 0 };
	for (int i = 1; i * i <= N; i++) {
		vs.push_back(i);
		vs.push_back(N / i);
	}
	sort(vs.begin(), vs.end());
	vs.erase(unique(vs.begin(), vs.end()), vs.end());
	const int n = vs.size();
	vector<int> to(n);
	for (int i = 1; i * i <= N; i++) {
		int u = lower_bound(vs.begin(), vs.end(), i) - vs.begin();
		int v = lower_bound(vs.begin(), vs.end(), N / i) - vs.begin();
		to[u] = v;
		to[v] = u;
	}
	vector<int> dp(n, 1);
	for (int i = 1; i < K; i++) {
		vector<int> tmp(n);
		dp.swap(tmp);
		for (int j = 1; j < n; j++) {
			int cnt = 1LL * (vs[j] - vs[j - 1]) * tmp[j] % mod;
			(dp[to[j]] += cnt) %= mod;
		}
		for (int j = n - 1; j > 0; j--) {
			(dp[j - 1] += dp[j]) %= mod;
		}
	}
	int res = 0;
	for (int i = 1; i < n; i++) {
		(res += 1LL * (vs[i] - vs[i - 1]) * dp[i] % mod) %= mod;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1404
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
LL get(LL x) {
	LL cnt = 0;
	do {
		++cnt;
		x /= 10;
	} while (x);
	return cnt;
}
int main() {
	LL n; cin >> n;
	LL ans = 0;
	for (LL i = 1; i <= n; ++i) ans += get(i) & 1;
	cout << ans; 
	return 0;
}

Measured memory_bytes: 256
MAX = 300000001

N, K = map(int, input().split())
xn = [int(i) for i in input().split()]


def main():
    if 0 < xn[0]:
        print(xn[K - 1])
        return

    if xn[N - 1] < 0:
        print(abs(xn[N - K]))
        return

    ans = MAX

    for i in range(N - K + 1):
        ans = min(ans,
                  2 * abs(xn[i]) + abs(xn[i + K - 1]),
                  abs(xn[i]) + 2 * abs(xn[i + K - 1]))

    print(ans)
    return


main()


Measured memory_bytes: 14384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

  ll n, m;
  cin >> n >> m;
  ll a, b;
  vector<P> p;
  REP(i, n){
    cin >> a >> b;
    p.push_back(P(a, b));
  }
  VSORT(p);
  ll cnt = 0, ans = 0;
  REP(i, n){
    a = p[i].first;
    b = p[i].second;
    if(cnt + b >= m){
      ans += a * (m - cnt);
      cout << ans << endl;
      return 0;
    }
    ans += a * b;
    cnt += b;
  }
  return 0;
}


Measured memory_bytes: 2420
#include<stdio.h>

int selectionSort(int A[],int N){
  int i,j,t,sw = 0,minj;
  for(i=0;i<N-1;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj])minj = j;
    }
    t = A[i]; A[i] = A[minj];A[minj]=t;
    if(i != minj)sw++;
  }
  return sw;
}

int main(){
  int A[100],N,i,sw;

  scanf("%d",&N);
  for(i=0;i<N;i++)scanf("%d",&A[i]);

  sw = selectionSort(A,N);

  for(i=0;i<N;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",sw);

  return 0;
}



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

int main() {
  string S;
  cin>>S;
  int N,M;
  N=S.size()/2;
  M=S.size();
  int count=0;
  for(int i=0;i<N;i++){
    if(S.at(i)!=S.at(M-1-i)){count++;}
  }
  cout<<count<<endl;
}




Measured memory_bytes: 256
#include <stdio.h>

void insertion();
void show();

int main(void){
	int size, i;
	scanf("%d",&size);
	int a[size];

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

	show(a, size);
	insertion(a, size);
	return 0;
}

void insertion(int x[], int len){
	int i, j, v;
	for(i = 1; i < len; i++){
		v = x[i];
		for(j = i - 1; j >= 0; j--){
			if(x[j] > v){
				x[j+1] = x[j];
			} else break;
		}
		x[j+1] = v;
		show(x, len);
	}
}

void show(int x[], int len){
	int i;
	printf("%d",x[0]);
	for(i = 1; i < len; i++){
		printf(" %d",x[i]);
	}
	printf("\n");
}

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

int main() {
  int N;
  cin >>  N;
  
  if(N%1110 <= 9 || N%1000%111 == 0) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(15) << << endl;
#include <cassert>
//#include "atcoder/all"

using namespace std;
//using namespace atcoder;

#define ll long long
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define P pair<int,int>

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
ll mod = 1000000007;

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

    string s; cin >> s;
    int n = s.size();

    if(s[n-1] == 's') cout << s + "es" << endl;
    else cout << s + "s" << endl;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = pow(10, 9) + 7;

int main() {
    // source
    ll n;
    cin >> n;

    ll table[10][10] = {};
    rep(i, n + 1) {
        string str = to_string(i);
        ll num0 = str[0] - '0';
        ll num1 = str[str.size() - 1] - '0';

        table[num0][num1]++;
    }

    ll ans = 0;
    repd(i, 1, 10) {
        repd(j, i, 10) {
            if (i == j) {
                ans += table[i][j] * table[j][i];
            } else {
                ans += table[i][j] * table[j][i] * 2;
            }
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  vector<map<int,int> > e(N);
  REP(i,N-1){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    e[a][b]=c;
    e[b][a]=c;
  }
  int Q,K;
  cin>>Q>>K;
  K--;
  lint v[N];
  REP(i,N)v[i]=-1;
  v[K]=0;
  queue<int> q;
  q.push(K);
  while(!q.empty()){
    for(auto i:e[q.front()]){
      if(v[i.first]>=0)continue;
      v[i.first]=v[q.front()]+i.second;
      q.push(i.first);
    }
    q.pop();
  }
  int x[Q],y[Q];
  REP(i,Q){
    cin>>x[i]>>y[i];
    x[i]--;y[i]--;
  }
  REP(i,Q)cout<<v[x[i]]+v[y[i]]<<endl;
  // REP(i,N)cerr<<v[i]<<endl;
  return 0;
}


Measured memory_bytes: 15104
#include <stdio.h>

int main(void){

  int total;
  int i;
  int pri;


  while(1){

  scanf("%d" ,&total);


  if( total == 0 ) break;


  i = 1;
  while( i < 10 ){

    scanf("%d" ,&pri);

    total -= pri;

    i++;
  }


  printf("%d\n" ,total);

  }

  return 0;

}

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

int main()
{
int H,W;
cin>> H>>W;
while(H!=0||W!=0)
{
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
	if(i%2==0){
		if(j%2==0)
			cout << '#';
		else
			cout << '.';
		}
	else
		{
		if(j%2==0)
			cout << '.';
		else
			cout << '#';
		}

}
cout << endl;
}
cout << endl;
cin >> H>>W;
}
return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i, n) cin >> a[i];

	int ans = 1;
	int w = n - k;
	int s = k - 1;

	ans += (w + s - 1) / s;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
function dp(point, visited, vertexes, memo)
  if not string.find(visited, "0") then
    return 1
  elseif memo[point][visited] then
    return memo[point][visited]
  else
    local ans = 0
    for i = 1, #vertexes[point] do
      if string.sub(visited, vertexes[point][i], vertexes[point][i]) == "0" then
        ans = ans + dp(vertexes[point][i], string.sub(visited, 1, vertexes[point][i] - 1) .. "1" .. string.sub(visited, vertexes[point][i] + 1, #visited), vertexes, memo)
      end
    end
    memo[point][visited] = ans
    return ans
  end
end

function main()
  local input = string.gmatch(io.read(), "[^ ]+")
  local n = tonumber(input())
  local m = tonumber(input())

  local vertexes = {}
  local memo = {}
  for i = 1, n do
    table.insert(vertexes, {})
    table.insert(memo, {})
  end

  for i = 1, m do
    input = string.gmatch(io.read(), "[^ ]+")
    local a = tonumber(input())
    local b = tonumber(input())
    table.insert(vertexes[a], b)
    table.insert(vertexes[b], a)
  end

  local visited = "1"
  for i = 2, n do
    visited = visited .. "0"
  end

  print(dp(1, visited, vertexes, memo))
end

main()


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  int N, D, X;
  cin >> N;
  cin >> D >> X;

  int ans = X;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;

    for (int j = 0;;) {
      const int f = 1 + a * j;
      if (f > D)
        break;
      ans++;
      ++j;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String [] args) {
		
		
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int [] arr = new int [n];
		
		for(int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		
		int n2 = in.nextInt();
		int [] arr2 = new int [n2];
		
		for(int i = 0; i < n2; i++) {
			arr2[i] = in.nextInt();
		}
		
		int count = 0;
		
		for(int i = 0; i < n2; i++) {
			
			for(int j = 0; j < n; j++) {
				if(arr2[i] == arr[j]) {
					count++;
					break;
					
				}
			}
		}
		
		System.out.println(count);
		
	}

}



Measured memory_bytes: 40264
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()

const ll Mod = 998244353;

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

    ll k,n;cin>>k>>n;
    vll a(n);
    ll m=0;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        if(i>0){
            m = max(m, a[i]-a[i-1]);
        }
    }
    m = max(m, a[0]+k-a[n-1]);
    cout<<k-m<<"\n";
    
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;


int main()
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a - b >= c) puts("0");
	else printf("%d\n", c - (a-b));
	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

ull Euclid(ull A, ull B){
    if(A<B) swap(A, B);
    ull C = B;
    while(C != 0){
        C = A%B;
        A = B;
        B = C;
    }
    return A;
}

int main(){
    ll N, X;
    cin >> N >> X;
    vector<ll> x(N);
    REP(i, N){
        cin >> x[i];
    }
    REP(i, N){
        x[i] = abs(X - x[i]);
    }
    ll res = x[0];
    REP(i, N-1){
        res = Euclid(res, x[i+1]);
    }
    cout << res << endl;

    return 0;
}

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

int main()
{
  long long x;
  cin >> x;
  long long ans;
  ans += (x/11)*2;
  x %= 11;
  if(x > 0 && x <= 6) ans++;
  else if(x > 6) ans += 2;
  cout << ans << endl;
}

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

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

    int h, w, k;
    cin >> h >> w >> k;
    int si, sj, gi, gj;
    cin >> si >> sj >> gi >> gj;
    --si;
    --sj;
    --gi;
    --gj;

    vector<string> c(h);
    rep(i, h) cin >> c[i];

    queue<pair<int, int>> q;
    q.push(make_pair(si, sj));
    
    const int INF = 1001001001;
    vector<vector<int>> dist(h, vector<int>(w, INF));
    dist[si][sj] = 0;

    const int di[] = {0, 1, 0, -1};
    const int dj[] = {1, 0, -1, 0};

    while(!q.empty()){
        pair<int, int> p = q.front();
        q.pop();
        int y = p.first;
        int x = p.second;

        rep(dir, 4){
            for(int i = 1; i <= k; ++i){
                int ny = y + di[dir]*i;
                int nx = x + dj[dir]*i;

                if(ny>=h || ny<0 || nx>=w || nx<0) break;
                if(c[ny][nx] == '@') break;
                if(dist[ny][nx] != INF){
                    if(dist[ny][nx] <= dist[y][x]) break;
                    else continue;
                }

                dist[ny][nx] = dist[y][x] + 1;

                q.push(make_pair(ny, nx));
            }
        }
    }

    // rep(i, h){
    //     rep(j, w) {
    //         if(dist[i][j] != INF) cout << dist[i][j] << " ";
    //         else cout << '@' << " ";
    //     }
    //     cout << endl;
    // }

    if(dist[gi][gj] != INF) cout << dist[gi][gj] << endl;
    else cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 12168
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    A,B = map(int,input().split())

    res = -1

    for i in range(1,1251):
        price8 = int(i*0.08)
        price10 = int(i*0.1)
        if (price8 == A) & (price10 == B):
            res = i
            break

    print(res)



main()


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

const int maxn=1e5+5;
int n,a[maxn],b[maxn],t1,t2,c[maxn];

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc=='-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

int main(){
	n=rd(); 
	go(i,n+1,1){
		c[i]=rd();
		if(i&1) a[++t1]=c[i];
		else b[++t2]=c[i];
	}
	sort(c+1,c+n+1);
	//sort(a+1,a+t1+1); sort(b+1,b+t2+1);
	int ans=0;
	go(i,t1+1,1){
		int pos=lower_bound(c+1,c+n+1,a[i])-c;
		if(!(pos&1)) ans++;
	}
	printf("%d",ans);
	return 0;
}//Faze


Measured memory_bytes: 1024