akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N, K;
    cin>>N>>K;
    vector<long long> x(N), y(N);
    for (int i=0; i<N; i++)
        cin>>x[i]>>y[i];

    vector<long long> sx = x;
    sort(sx.begin(), sx.end());
    vector<long long> sy = y;
    sort(sy.begin(), sy.end());


    long long ans = 0x7fffffffffffffffLL;
    for (int l=0; l<N; l++)
    for (int r=l+1; r<N; r++)
    {
        int u = 0;
        int d = 0;
        while (d<N)
        {
            int c = 0;
            for (int i=0; i<N; i++)
                if (sx[l]<=x[i] && x[i]<=sx[r] &&
                    sy[u]<=y[i] && y[i]<=sy[d])
                    c++;
            if (c >= K)
                ans = min(ans, (sx[r]-sx[l])*(sy[d]-sy[u]));
            (c >= K ? u : d)++;
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <unordered_map>
typedef long long ll;
using namespace std;
const int mod=1e9+7;
string solve(){
    string s;
    cin>>s;
    ll sm=0;
    for(char c:s) sm+=(c-'0');
    return (sm%9)?"No":"Yes";   
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    int t=1;
    //cin>>t;
    while(t--) cout<<solve()<<'\n';
    //while(t--) solve(),cout<<'\n';
    return 0;
}


Measured memory_bytes: 3712
#include <iostream>

using namespace std;

int main()
{
    int n, a, b, c, d;

    string s;

    cin >> n >> a >> b >> c >> d;

    cin >> s;


    if(c<=d)
    {
        a--, b--, c--, d--;

        bool flag = true;

        for(int i=b; i<d; i++)
        {
            if(s[i]=='#' and s[i+1]=='#')
                flag = false;
        }

        for(int i=a; i<c; i++)
        {
            if(s[i]=='#' and s[i+1]=='#')
                flag = false;
        }

        if(flag)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    else
    {
        a--, b--, c--, d--;

        bool flag = false;

        for (int i = b; i <= d; i++)
        {
            if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.')
                flag = true;
        }

        if (flag == false)
        {
            cout << "No" << endl;

            return 0;
        }

        for (int i = a; i < c; i++)
        {
            if (s[i] == '#' && s[i + 1] == '#')
                flag = false;
        }

        if (flag)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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 long long INF = 1LL << 60;

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

  int cnt1 = 0;
  int cnt2 = 0;
  int cnt4 = 0;
  rep(i, n){
    int a; cin >> a;
    if(a%4 == 0) cnt4++;
    else if(a%2 == 0) cnt2++;
  }

  if(cnt2 == 0){
    cout << (cnt4*2 +1 >= n ? "Yes" : "No") << endl;
    return 0;
  }

  cout << (cnt4*2 >= n-cnt2 ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int a, b;
  cin >> a >> b;
  if(a < b) swap(a, b);
  cout << max(2 * a - 1, a + b) << endl;
  return 0;
}

Measured memory_bytes: 256
d = int(input())
c = list(map(int , input().split()))
s = [list(map(int , input().split())) for _ in range(d)]

ans = 0
last = [0] * 26
for di in range(1, d+1):
    ti = int(input()) - 1
    last[ti] = di
    for i in range(26):
        ans -= (di - last[i]) * c[i]
    ans += s[di-1][ti]
    print(ans)


Measured memory_bytes: 9388
#include<iostream>

using namespace std;

int main(void)
{
	int x = 0 ,y = 0 ,z = 0;
	cin >> x >> y >> z;
	
	if( x < y && y < z ) cout << "Yes" << endl;
	else				 cout << "No"  << endl;
	
	return 0;
} 


Measured memory_bytes: 3092
bits = [0]*60

n = int(input())
arr = list(map(int, input().split()))

mod = pow(10, 9) + 7
res = 0
eles = 0
mx = 0
for i in range(n-1, -1, -1):
	ele = arr[i]
	mx = max(mx, ele.bit_length())
	add = 0
	for j in range(mx):
		if ele&(1<<j):
			add += (eles - bits[j])*pow(2, j)
			bits[j] += 1
		else:
			add += (bits[j])*pow(2, j)
	res += add
	res %= mod
	eles += 1
print(res)

Measured memory_bytes: 125624
//Atcoder Round148 task:b
#include<iostream>
using namespace std;


int main(){
    int n;
	string s,t;
	cin>>n;
	cin>>s>>t;
	for(int i=0;i<n;i++){
		cout<<s[i];
		cout<<t[i];
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		Scanner scan = new Scanner(System.in);
		int dice1[] = new int[6];
		int dice2[] = new int[6];
		boolean sameDice = false;
		
		diceClass dice = new diceClass();

		for (int i=0;i<6;i++){
			dice1[i] = scan.nextInt();
		}
		for (int i=0;i<6;i++){
			dice2[i] = scan.nextInt();
			dice.pos[i] = dice2[i];
		}
		int compareNum [] = dice2.clone();

		for(int i=0;i<4;i++){			//??¨???????????????????????§????????¢????????°??±???????????????????????????
			for(int ii=0;ii<4;ii++){
				for(int iii=0;iii<4;iii++){
					sameDice = dice.compare(dice1, compareNum);
					if(sameDice == true){
						break;
					}
					compareNum = dice.move(i);
					sameDice = dice.compare(dice1, compareNum);
					if(sameDice == true){
						break;
					}
					compareNum = dice.move(ii);
					sameDice = dice.compare(dice1, compareNum);
					if(sameDice == true){
						break;
					}
					compareNum = dice.move(iii);
					sameDice = dice.compare(dice1, compareNum);
					if(sameDice == true){
						break;
					}
				}
			}
			if(sameDice == true){
				break;
			}
		}
		if(sameDice == true){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}

class diceClass{	
	int pos[] = new int[6];
	int up0[] = {1,2,4,3};
	int up1[] = {0,3,5,2};
	int up2[] = {0,1,5,4};
	int up3[] = {0,4,5,1};
	int up4[] = {0,2,5,3};
	int up5[] = {1,3,4,2};
	public diceClass(){

	}

	public int[] move(int direction){		//?????????????????¢?????????????????°??????????????????????????????
		int[] temp = (int[])pos.clone();
		if(direction == 0){
			pos[0] = temp[1];
			pos[1] = temp[5];
			pos[2] = temp[2];
			pos[3] = temp[3];
			pos[4] = temp[0];
			pos[5] = temp[4];
		}
		else if(direction == 1){
			pos[0] = temp[3];
			pos[1] = temp[1];
			pos[2] = temp[0];
			pos[3] = temp[5];
			pos[4] = temp[4];
			pos[5] = temp[2];
		}
		else if(direction == 2){
			pos[0] = temp[2];
			pos[1] = temp[1];
			pos[2] = temp[5];
			pos[3] = temp[0];
			pos[4] = temp[4];
			pos[5] = temp[3];
		}
		else if(direction == 3){
			pos[0] = temp[4];
			pos[1] = temp[0];
			pos[2] = temp[2];
			pos[3] = temp[3];
			pos[4] = temp[5];
			pos[5] = temp[1];
		}
		return pos;
	}

	public boolean compare(int[] n1,int[] n2){		//????????????????????????????????§???????????????????????????
		if(n1[0] == n2[0] && n1[1] == n2[1] && n1[2] == n2[2]
				&& n1[3] == n2[3] && n1[4] == n2[4] && n1[5] == n2[5]){
			return true;
		}
		else{
			return false;
		}
	}
}

Measured memory_bytes: 26428
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <iomanip>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = 1000000;
    REP(i, s.size() - 2) {
        int diff = abs(stoi(s.substr(i, 3)) - 753);
        ans = min(ans, diff);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< i_i, int>
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign

vi graph, score;
int n;

int search(int pos, int num)
{
    int ret = pos;
    //if (pos >= n) pos = n-1;
    if (score[pos] > num) {
//        cout << ":" << pos << " " << score[pos] << " " << num << endl;
        score[pos] = num;
        if (graph[pos]) {
            ret = search(pos + graph[pos], num);
        } else {
            return pos;
        }
    } else {
        return -1;
    }
    return ret;
}

signed main()
{
    cin >> n;
    graph = vi(n, 0);
    rep(i, n) {
        cin >> graph[i];
    }
    score = vi(n, INF);

    score[0] = 0;
    queue<int> que;
    que.push(0);

    int loop = 2;
    while (score[n-1] == INF) {
   // while (loop--) {
        int pos = que.front();
       // cout << pos << endl;
        que.pop();
        Rep(i, 7) {
            int nxt = pos + i;
         //   cout << nxt << " ";
            if (nxt >= n) nxt = n-1;
            if (score[pos]+1 < score[nxt]) {
                int tmp = search(nxt, score[pos]+1);
  //              cout << tmp << endl;
                if (tmp != -1) que.push(tmp);
            }
        }
        //cout << endl;
        //cout << "======" << endl;
        //rep(i, n) cout << score[i] << " ";
        //cout << endl;
    }
    /*
    rep(i, n) {
        cout << score[i] << " ";
    }cout << endl;
    */

    cout << score[n-1] << endl;

    return 0;
}

Measured memory_bytes: 5012
# -*- coding: utf-8 -*-
# Next Prime

import sys


TEST_INPUT = \
"""

100000

"""

TEST_OUTPUT = \
"""

100003

"""


def primes(n):
    if n == 0 or n == 1: return []
    
    ps = [2]
    for odd in range(3, n + 1, 2):
        for p in ps:
            if odd % p == 0:
                break
            if p ** 2 > odd:
                ps.append(odd)
                break
    return ps


def isprime(n):
    if n == 0 or n == 1: return False
    
    last = int(n**.5)
    for m in primes(last):
        if n % m == 0:
            return False
    return True


def nextprime(n):
    if n in primes(n):
        return n
    else:
        i = n
        while not isprime(i):
            i += 1
        return i


def main(stdin):
    n = int(stdin)
    print(nextprime(n))


if __name__ == "__main__":
    main(sys.stdin.read().strip())

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int last = -1;
    int num = 0;
    int res = 0;
    for (int i = 1; i <= n; i++) {
        int u;
        cin >> u;
        if (u <= last) {
            num++;
        } else {
            num = 1;
        }
        last = u;
        res = max(res, num);
    }
    cout << res - 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n;
  int i;
  int flg=0;
  
  scanf("%d", &n);
  
  for(i=9;i>0;i--){
    if(n%i==0){
      if(n / i < 10){
        printf("Yes\n");
        flg=1;
        break;
      }
    }
  }
  if(flg==0){
    printf("No\n");
  }
  return 0;
}
    
  

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

int X[200001];
int Y[100001];

int main(){
	int N,M;
	cin>>N>>M;
	for(int i=0;i<N;i++){
		int x;
		cin>>x;
		X[x]++;
		Y[x%M]++;
	}
	int res = 0;
	res += Y[0]/2;
	//for(int i=0;i<M;i++){cout<<Y[i]<<endl;}
	for(int i=1;i<M/2+1;i++){
		//cout<<res<<endl;
		if(i == M-i){
			res += Y[i]/2;
		}
		else{
			res += min(Y[i],Y[M-i]);
			//cout<<i<<","<<res<<endl;
			int ind;
			if(Y[i] < Y[M-i]){
				ind = M-i;
			}
			else if(Y[M-i] < Y[i]){
				ind = i;
			}
			else{
				continue;
			}
			int cnt = 0;
			for(int j=ind;j<100001;j+=M){
				cnt += X[j]/2;
			}
			res += min(cnt,(max(Y[i],Y[M-i])-min(Y[i],Y[M-i]))/2);
		}
		
		//cout<<res<<endl;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 1024
N, K =map(int, input().split())
mod = 10**9 + 7
A = int(-(N+1)*(N+2)*(2*N+3)/6)%mod
B = int((N+1)*(N+1)*(N+2)/2)%mod
C = N+1
a = int(-(K-1)*K*(2*K-1)/6)%mod
b = int((N+1)*(K-1)*K/2)%mod
c = K-1
print((A+B+C-a-b-c)%mod)


Measured memory_bytes: 9196
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int a[5], k;
	for (int i = 0; i < 5; i++){
		scanf("%d", &a[i]);
	}
	scanf("%d", &k);
	sort(a, a + 5);
	if (a[4] - a[0] > k){
		printf(":(\n");
	}else{
		printf("Yay!\n");
	}
}

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

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  cin >> n;
  vector< ll > h(n);
  for (ll i=0; i<n; ++i) cin >> h[i];
  h[0]--;
  for (ul i=1; i<n; ++i) {
    if (h[i-1]<h[i]) h[i]--;
    if (h[i-1]>h[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
#define TEMP(type,x,y) do {temp temp=x,x=y,y=temp}while(0)
const ll INF = (1LL << 50);

int main() {


	// 011101010110011
	// 0 1 3 1 1 1 1 1 2 2 2 ←個数 0,2,4番目は連続する0の個数 1,3,4番目は連続する1の個数
	// 1 0 1 0 1 0 1 0 1 0 1 ←0or1

	int N, K; cin >> N >> K;
	string S; cin >> S;

	// 「1 の個数」「0 の個数」を交互に記録していく
	vector<int> nums;
	if (S[0] == '0') nums.push_back(0); // 先頭が 0 だったら
	for (int i = 0; i < S.size();) {
		int j = i;
		while (j < S.size() && S[j] == S[i]) ++j; // S[i] の数値がどこまで続くか
		nums.push_back(j - i);
		i = j;
	}
	if (S.back() == '0') nums.push_back(0); // 最後尾が 0 だったら

	// 累積和
	vector<int> sums((int)nums.size() + 1, 0);
	for (int i = 0; i < nums.size(); ++i) sums[i + 1] = sums[i] + nums[i];

	// 偶数番目の添字から始まる、長さ 2K+1 (以下) の区間の総和のうち、最大値を求める
	int res = 0;
	for (int left = 0; left < sums.size(); left += 2) {
		int right = left + K * 2 + 1;
		if (right >= sums.size()) right = (int)sums.size() - 1;
		res = max(res, sums[right] - sums[left]);
	}
	cout << res << endl;

	return 0;

}

Measured memory_bytes: 1272
from heapq import*
import sys
r=sys.stdin.readline
def g(n,E,S,G):
 F=[1e7]*-~n;F[S]=0
 H=[(0,S)]
 while H:
  c,u=heappop(H)
  if u==G:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:
    F[v]=t
    heappush(H,(t,v))
 return-1
def s(n,k):
 E=[[]for _ in[0]*-~n]
 for _ in[0]*k:
  f=r()
  if'0'==f[0]:print(g(n,E,*map(int,f[2:].split())))
  else:c,d,e=map(int,f[2:].split());E[c]+=[(e,d)];E[d]+=[(e,c)]
for e in iter(r,'0 0\n'):s(*map(int,e.split()))


Measured memory_bytes: 6304
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll N, K;
    cin >> N >> K;

    if(K > (N-1)*(N-2)/2){
        print(-1);
        return 0;
    }

    vector<P> edge;
    rep1(i, N - 1) edge.pb({i, N});

    vector<P> pool;
    rep1(i, N - 1) rep1(j, N - 1) if (i < j) pool.pb({i, j});

    rep(i, (N - 1) * (N - 2) / 2 - K) edge.pb(pool[i]);

    print(len(edge));
    rep(i, len(edge)) cout << edge[i].first << " " << edge[i].second << '\n';

    return 0;
}

Measured memory_bytes: 512
//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
int P[100001];
long long A[100001],B[100001],C[100001];
int D[100001];

int main() {
	int N,M;
	long long R=0;
	cin>>N>>M;
	for(int j=1;j<M+1;j++){
		cin>>P[j];
	}
	for(int i=1;i<N;i++){
		cin>>A[i]>>B[i]>>C[i];
	}
	for(int i=1;i<M;i++){
		if(P[i]<P[i+1]){
			for(int j=P[i];j<P[i+1];j++){
				D[j]+=1;
			}
		}
		if(P[i]>P[i+1]){
			for(int j=P[i+1];j<P[i];j++){
				D[j]+=1;
			}
		}
	}
	for(int j=1;j<N;j++){
		if(D[j]*A[j]>D[j]*B[j]+C[j]){
			R+=D[j]*B[j]+C[j];
		}
		else R+=D[j]*A[j];
	}
	cout<<R<<endl;
	return 0;
}

Measured memory_bytes: 6216
def main():
    n,m=map(int,input().split())
    ab=[list(map(int,input().split())) for _ in [0]*(n+m-1)]
    g2=[[] for _ in [0]*n]
    [g2[b-1].append(a-1) for a,b in ab]
    for i in range(n):
        if len(g2[i])==0:
            root=i
            break
    g2=[len(i) for i in g2]
    g=[[] for _ in [0]*n]
    [g[a-1].append(b-1) for a,b in ab]
    q=[root]
    r=[0]*n
    while q:
        qq=[]
        while q:
            i=q.pop()
            for j in g[i]:
                if g2[j]==1:
                    qq.append(j)
                    r[j]=i+1
                g2[j]-=1
        q=qq
    for i in r:
        print(i)
main()

Measured memory_bytes: 45472
n=int(input())
list1 = list(map(int, input().split()))
cnt = 0
for i in range(0,n-2):
    if (list1[i]>list1[i+1] and list1[i+1]>list1[i+2]):
        cnt += 1
    if (list1[i]<list1[i+1] and list1[i+1]<list1[i+2]):
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        String words, sentence;
        sentence = scan.next();
        words = scan.next();
        int result;
        
        sentence+=sentence;
        if(sentence.indexOf(words)!=-1)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 26324
#include <iostream>
#include <climits>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vll vector<long long>
#define vb vector<bool>
#define vs vector<string>
#define px(x) cout << x << endl
#define pfi(x) printf("%d\n", x)
#define pfs(x) printf("%s\n", x)
#define sfi(x) scanf("%d", &x)
#define sfs(x) scanf("%s", x)

int main() {
    int n;
    int m;
    cin >> n >> m;
    if(n == m){
        cout << "Yes";
    }else{
        cout << "No";
    }


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int a, n, q;
    cin>>n;
    set<int> S;
    rep(i, n) {
        cin>>a;
        S.insert(a);
    }
    cin>>q;
    set<int> T;
    rep(i, q) {
        cin>>a;
        T.insert(a);
    }

    set<int> res;
    set_intersection(S.begin(), S.end(), T.begin(), T.end(), inserter(res, res.end()));
    cout<<res.size()<<endl;
}


Measured memory_bytes: 3172
# -*- coding: utf-8 -*-
n = int(input())

s4s = [4 * i for i in range(26)]
s7s = [7 * i for i in range(15)]

for s4 in s4s:
    for s7 in s7s:
        if s4 + s7 == n:
            print('Yes')
            exit()
else:
    print('No')


Measured memory_bytes: 2940
#include<stdio.h>

int main(){

  double bmi, tall, weight;
  int num, out;
  char trash[2];

  out = 0;

  while(scanf("%d %c %lf %c %lf",&num,&trash[0],&weight,&trash[1],&tall) != EOF){

    bmi = weight / tall/ tall;

    if(bmi >= 25){

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

      out++;
    }
  }


  if(out == 0){
    printf("ツ該ツ督鳴づ按つオ\n");
  }



  return 0;

}
    

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

int main(){
  string n;
  int s,l[4]={0};
  while(cin>>n){
    s=n.size();
    if(n[s-1]=='O')l[0]++;
    else if(n[s-1]=='A')l[1]++;
    else if(n[s-1]=='B'&&n[s-2]=='A')l[2]++;
    else if(n[s-1]=='B')l[3]++;
  }
  cout<<l[1]<<endl<<l[3]<<endl<<l[2]<<endl<<l[0]<<endl;
  return 0;
}

Measured memory_bytes: 3132
import sys
nums = int(input())
ary = list(range(nums))
good = False

for i in range(nums):
    ary[i] = list(map(int,input().split()))

for i in range(nums):
    sum = ary[i][1]+ary[i][2]
    if sum % 2 == 1:
        if ary[i][0] >= sum and ary[i][0] % 2 == 1:
            good = True
        else:
            print("No")
            sys.exit()
    if sum % 2 == 0:
        if ary[i][0] >= sum and ary[i][0] % 2 == 0:
            good = True
        else:
            print("No")
            sys.exit()
print("Yes")

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

using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());
// map<int,int> mp;

int main() {
  int A, B;
  cin >> A >> B;
  int ans = -1;

  if (A <= 9 && B <= 9) {
    ans = A * B;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm> // std::sort(begin,end), std::min, std::max
#include <iostream>
#include <queue>
#include <string>
#include <unordered_map>
#include <utility> // std::swap
#include <vector>

using namespace std;
using ll = long long;

ll tbl[3001][3001] = {};

int main(int argc, char const *argv[]) {

  ll n, t, a, b;
  cin >> n >> t;
  vector<pair<ll, ll>> ab(n);
  for (ll i = 0; i < n; i++) {
    cin >> a >> b;
    ab[i] = make_pair(a, b);
  }
  sort(ab.begin(), ab.end());
  ll ret = ab[0].second;
  for (int i = 0; i < n; i++) {
    a = ab[i].first;
    b = ab[i].second;
    for (int l = 0; l <= t; l++) {
      if (i == 0) {
        if (l < a) {
          tbl[i][l] = 0;
        } else {
          tbl[i][l] = b;
        }
      } else {
        if (l < a || (tbl[i - 1][l - a] + b) < tbl[i - 1][l]) {
          tbl[i][l] = tbl[i - 1][l];
        } else {
          tbl[i][l] = (tbl[i - 1][l - a] + b);
        }
      }
    }
    if (i > 0) {
      ret = max(ret, tbl[i - 1][t - 1] + b);
    }
  }

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 70656
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int mod = 2019;
int l, r;

signed main() {
	cin >> l >> r;
	if (r - l >= 2 * mod) { cout << 0 << endl; return 0; }
	
	int i, j;
	int ans = mod * mod;
	for (i = l; i <= r; i++) {
		for (j = i + 1; j <= r; j++) {
			ans = min(ans, (i * j) % mod);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void){
    int N;
    scanf("%d",&N);
    int A[N],ref[N];
    for (int i = 0; i < N; i++){
        scanf("%d",&A[i]);
    }
    int count=1;
    int flag;
    ref[0]=A[0];
    for (int i = 1; i < N; i++){
        flag=0;
        for (int j = 0; j < count; j++){
            if (A[i] == ref[j]){
                flag=1;
                break;
            }
        }
        if (flag==0){
            ref[count]=A[i];
            count++;
        }
    }
    printf("%d",count);
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10**6)
from functools import lru_cache

n = int(input())
x = input()
mod = x.count("1")
flag = (mod == 1)
if mod == 0:
    for i in range(n):
        print(1)
    exit()
@lru_cache(maxsize = n+1)
def f(x):
    if x==0:return 0
    y = x
    cnt = 0
    while y>0:
        cnt += y&1
        y >>= 1
    x %= cnt
    return f(x) + 1
if mod == 1:mod += 2
powmod = [[1%(mod-1)]*n,[1%(mod+1)]*n]

for i in range(n-1):
    powmod[0][i+1] = powmod[0][i]*2%(mod-1)
    powmod[1][i+1] = powmod[1][i]*2%(mod+1)

X = [0,0]
for i,b in enumerate(x[::-1]):
    X[0] += powmod[0][i]*int(b)
    X[1] += powmod[1][i]*int(b)
    X[0] %= mod-1
    X[1] %= mod+1
ans = [0]*n
for i in range(n):
    if flag:
        if x[n-1-i] == "1":
            ans[n-1-i] = 0
        else:
            now = (X[0] + powmod[0][i])%(mod-1)
            ans[n-i-1] = f(now) + 1
        continue
    if x[n-1-i] == "1":
        now = (X[0] - powmod[0][i])%(mod-1)
    else:
        now = (X[1] + powmod[1][i])%(mod+1)
    ans[n-i-1] = f(now) + 1
print("\n".join(str(i) for i in ans))


Measured memory_bytes: 102296
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

typedef long long ll;
int main(){
 int x,a,b; cin >> x >> a >> b;
  if( b <= a){ cout << "delicious" << endl;}
  else if( a+x >= b){ cout << "safe" << endl;}
  else{ cout << "dangerous" << endl;}
  return 0;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=1<<29,MOD=1e9+7;

int main(){
	int n; cin>>n;
	int a[n]; rep(i,n) cin>>a[i];
	int b[n]={a[0]};
	int c[n]={a[0]};
	long ans1=0,ans2=0;
	//偶数番目は正
	rep(i,n){
		if(i) b[i]=b[i-1]+a[i];
		if(i%2==0&&b[i]<=0){
			ans1+=1-b[i];
			b[i]=1;
		}
		if(i%2==1&&b[i]>=0){
			ans1+=b[i]+1;
			b[i]=-1;
		}
	}
	//偶数番目は負
	rep(i,n){
		if(i) c[i]=c[i-1]+a[i];
		if(i%2==1&&c[i]<=0){
			ans2+=1-c[i];
			c[i]=1;
		}
		if(i%2==0&&c[i]>=0){
			ans2+=c[i]+1;
			c[i]=-1;
		}
	}
	cout<<min(ans1,ans2)<<endl;
	return 0;
}


Measured memory_bytes: 1408
N = int(input())
s = [list(input()) for _ in range(N)]
S = []
for i in range(N):
    temp = "".join(sorted(s[i]))
    S.append(temp)

D = {}
cnt = 0
for str in S:
    if str in D:
        cnt += D[str]
        D[str] += 1
    else:
        D[str] = 1

print(cnt)


Measured memory_bytes: 40688
N,M=map(int,input().split())
H=map(int,input().split())
H=list(H)
ans=[1 for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]==H[b-1]:ans[a-1],ans[b-1]=0,0
    if H[a-1]>H[b-1]:ans[b-1]=0
    if H[a-1]<H[b-1]:ans[a-1]=0
print(sum(ans))   

Measured memory_bytes: 20140
import java.util.Scanner;

public class Main {
    private static void insertionSort(int[] list) {
        int len = list.length;
        printList(list);
        for (int i=1;i<len;i++){
            int move = list[i];
            int j = i-1;
            while (j>=0 && list[j] > move){
                list[j+1] = list[j];
                j--;
            }
            list[j+1] = move;
            printList(list);
        }
    }
    private static void printList(int[] list){
        for (int i=0;i<list.length;i++){
            System.out.printf("%d",list[i]);
            if (i != list.length-1){
                System.out.print(" ");
            }
        }
        System.out.print("\n");
    }
    public static void main(String args[]){
        int n;
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        int[] list = new int[n];

        for (int i=0;i<n;i++){
            list[i] = scanner.nextInt();
        }
        insertionSort(list);
    }
}



Measured memory_bytes: 43976
#include <iostream>
#include <cstdio>
#define maxn 100010
#define Lovelive long long
using namespace std;
int seq[maxn];

int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> seq[i];
	}
	Lovelive mi = 2, ma = 2;
	for(int i = n; i >= 1; i--) {
		if(mi % seq[i] && ma % seq[i] && mi/seq[i] == ma/seq[i]) return puts("-1"), 0;
		mi = seq[i] * ((mi-1)/seq[i]+1);
		ma = seq[i] * (ma/seq[i]) + seq[i] - 1;
	}
	cout << mi << ' ' << ma << endl;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(){
	int a,b,c,s=0,i;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(i%c==0)
			s = s + 1;
	} 
	printf("%d",s);
} 

Measured memory_bytes: 1724
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;

static const double eps = 1e-8;

int main(){

	int res=0;
	for(int i=0;i<2;i++){
		int sum = 0;
		for(int j=0;j<4;j++){
			int p;
			scanf("%d",&p);
			sum += p;
		}
		res = max(sum,res);
	}

	printf("%d\n",res);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
using vi=vector<int>;
#define PB push_back
#define ALL(x) x.begin(),x.end()
//#define LN cerr<<__LINE__<<endl
#define LN 0
using pi=pair<int,int>;
int read(){
	int i;
	scanf("%d",&i);
	return i;
}
void chmin(int&a,int b){
	a=a<b?a:b;
}
void chmax(int&a,int b){
	a=a>b?a:b;
}
struct SegTree{
	vi buf;
	int s;
	SegTree(int n){
		s=1;
		while(s<n)s*=2;
		buf.resize(s*2,-1);
	}
	void Update(int i,int v){
		i+=s;
		buf[i]=v;
		while((i/=2)>=1)buf[i]=max(buf[i*2],buf[i*2+1]);
	}
	int GetIdx(int b,int e,int t,vi&dst,int l,int r,int i){
		if(buf[i]<=t||e<=l||r<=b)return t;
		if(b<=l&&r<=e){
			if(l+1==r){
				if(t<buf[i])dst.PB(l);
				return max(t,buf[i]);
			}else{
				if(t<buf[i*2])
					t=GetIdx(b,e,t,dst,l,(l+r)/2,i*2);
				if(t<buf[i*2+1])
					t=GetIdx(b,e,t,dst,(l+r)/2,r,i*2+1);
				return t;
			}
		}
		t=GetIdx(b,e,t,dst,l,(l+r)/2,i*2);
		t=GetIdx(b,e,t,dst,(l+r)/2,r,i*2+1);
		return t;
	}
	void GetIdx(int b,int e,vi& dst){
		GetIdx(b,e,-1,dst,0,s,1);
	}
	int get(int x){
		return buf[x+s];
	}
};
inline int xorshift(){
	static int w=1145141919;
	w=w^(w<<17);
	w=w^(w>>13);
	w=w^(w<<5);
	return w;
}
struct Node{
	Node *l,*r;
	int v,s;
} buf[200010];
Node* Merge(Node*a,Node*b){
	if(!a)return b;
	if(!b)return a;
	int s=a->s+b->s,x=xorshift()%s;
	if(x<a->s){
		a->r=Merge(a->r,b);
		a->s=s;
		return a;
	}else{
		b->l=Merge(a,b->l);
		b->s=s;
		return b;
	}
}
using pn=pair<Node*,Node*>;
pn Split(Node*x,int t){
	if(!x)return pn(0,0);
	if(t<=x->v){
		pn c=Split(x->l,t);
		if(c.first)x->s-=c.first->s;
		x->l=c.second;
		return pn(c.first,x);
	}else{
		pn c=Split(x->r,t);
		if(c.second)x->s-=c.second->s;
		x->r=c.first;
		return pn(x,c.second);
	}
}
int MaxValue(Node* x){
	while(x->r)x=x->r;
	return x->v;
}
void Show(Node* x){
	if(!x)return;
	Show(x->l);
	cerr<<x->v<<" ";
	Show(x->r);
}
int main(){
	int n=read();
	SegTree seg(n*2);
	vector<Node*> trs(n*2);
	vi mx(n*2,-1);
	REP(i,n){
		int x=read()-1;
		seg.Update(i,x);
		trs[i]=buf+i;
		trs[i]->v=x;
		trs[i]->s=1;
		mx[i]=x;
	}
	vi idx;
	int sum=0;
	FOR(i,n,n*2){
		idx.clear();
		seg.GetIdx(0,i,idx);
		int last=-1;
		Node*x=0;
		sum+=idx.size();
		for(auto j:idx){
			LN;
			pn c=Split(trs[j],last);
			LN;
			last=mx[j];
			LN;
			if(c.first)
				mx[j]=MaxValue(c.first);
			else
				mx[j]=-1;
			LN;
			seg.Update(j,mx[j]);
			LN;
			trs[j]=c.first;
			LN;
			x=Merge(x,c.second);
			LN;
		}
		if(x->s==n){
			cout<<i-n<<endl;
			return 0;
		}
		if(sum>=3e6)return 0;
		mx[i]=last;
		seg.Update(i,mx[i]);
		trs[i]=x;
		//Show(x);
	}
}

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

void init(vector<int> &par, vector<int> &height, int n);
int find(vector<int> &par, vector<int> &height, int x);
void unite(vector<int> &par, vector<int> &height, int x, int y);
bool same(vector<int> &par, vector<int> &height, int x, int y);


int main(){
    int n,m;
    cin>>n>>m;
    vector<int> par(n);
    vector<int> height(n);
    init(par,height,n);

    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        x--; y--;
        if(!same(par, height,x,y)){
            unite(par, height,x,y);
        }
    }

    map<int, int> dictionary;
    int ans = 0;
    for(int i=0;i<n;i++){
        //根ルートを探す
        int a = find(par, height, i);
        //もし他にあるなら足す
        if(dictionary.find(a)!=end(dictionary)){
            dictionary[a] += 1;
        }
        else{
            dictionary[a] = 1;
        }
        ans = max(ans, dictionary[a]);
    }

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

void init(vector<int> &par, vector<int> &height, int n){
    for(int i=0;i<n;i++){
        par[i] = i;
        height[i] = 0;
    }
}

int find(vector<int> &par, vector<int> &height, int x){
    if(par[x] == x) return x;
    return par[x] = find(par, height, par[x]);
}

void unite(vector<int> &par, vector<int> &height, int x, int y){
    x = find(par, height,x);
    y = find(par, height, y);
    if(x==y) return;
    if(height[x]>height[y]) par[y] = x;
    else{
        par[x] = y;
        if(height[x]==height[y]) height[y]++;
    }
}

bool same(vector<int> &par, vector<int> &height, int x, int y){
    return find(par, height, x) == find(par, height, y);
}



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


int main()
{
    int h, n;
    cin >> h >> n;
    int ai;
    for (int i = 0; i < n; i++) {
        cin >> ai;
        h -= ai;
    }
    if (h <= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int N;
    cin>>N;
    int lis[100000];
    for(int i=0;i<N;i++)cin>>lis[i];
    for(int i=N-1;1<=i;i--){
        if(lis[i-1]>lis[i]){
            lis[i-1]--;
            if(lis[i-1]>lis[i]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 640
import sys
import math

a, b, x = map(int, input().split())


if(x > a*a*b):
    sys.exit()

if (a*a*b/2 >= x):
    s = math.degrees(math.atan(a*b*b/2/x))
else:
    s = math.degrees(math.atan(2*(a*a*b-x)/a/a/a))

print (s)


Measured memory_bytes: 3060
s = gets.to_i

list = []
list[s] = 1

(2..1000000).each do |i|
  if s.even?
    s /= 2
  else
    s = 3 * s + 1
  end

  if list[s]
    puts i
    break
  else
    list[s] = 1
  end
end


Measured memory_bytes: 1916
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
bool compare(pair<int,int>a,pair<int,int>b){
    if(a.first==b.first)return a.second<b.second;
    else return a.first<b.first;
}
int main(){
    int n;
    cin>>n;
    vector<pair<int,int>> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i].first;
        a[i].second=i;
    }
    sort(a.begin(),a.end(),compare);
    for(int i=0;i<n;i++){
        cout<<a[i].second+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 1664
// abc079_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    string S;
    cin >> S;

    REP(p, 1 << 3){

        int tmp = S[0] - '0';
        string ans;
        ans += S[0];
        REP(i, 3){
            if ((p >> i) & 1){
                tmp += S[i+1] - '0';
                ans += "+";
                ans += S[i+1];
            } else {
                tmp -= S[i+1] - '0';
                ans += "-";
                ans += S[i+1];
            }
        }

        if (tmp == 7){
            ans += "=7";
            print(ans);
            break;
        }
    }

    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int N;
  cin >> N;

  int ans = 0;
  for (int i = 1; i <= N; i += 2) {
    int sum = 0;
    for (int j = 1; j <= i; j++) {
      if (i % j == 0) {
        sum++;
      }
    }
    if (sum == 8) {
      ans++;
    }
  }
  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<cassert>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%p;
		x = x * x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n, k;
	cin >> n >> k;
	int ans = 0;
	if (k % 2 == 0) {
		int sum = round(1.0*n / k);
		ans = sum * sum * sum;
	}
	int res = n / k;
	ans += res * res*res;
	cout << ans << endl;
}

Measured memory_bytes: 256
def countInRangeUtil(pos, cnt, tight, num):   
    if pos == len(num):   
        if cnt == K: 
            return 1
        return 0
  
    if dp[pos][cnt][tight] != -1: 
        return dp[pos][cnt][tight] 
  
    ans = 0
  
    limit = 9 if tight else num[pos] 
  
    for dig in range(limit + 1): 
        currCnt = cnt 
  
        if dig != 0: 
            currCnt += 1
  
        currTight = tight 
  
        if dig < num[pos]: 
            currTight = 1
  
        ans += countInRangeUtil(pos + 1, currCnt, currTight, num) 
  
    dp[pos][cnt][tight] = ans 
    return dp[pos][cnt][tight] 
  
def countInRange(x): 
    global dp, K, M 
  
    num = [] 
    while x: 
        num.append(x % 10) 
        x //= 10
  
    num.reverse() 
  
    dp = [[[-1, -1] for i in range(M)] for j in range(M)] 
    return countInRangeUtil(0, 0, 0, num) 
  
dp = [] 
M = 100
N = int(input())
K = int(input())

print(countInRange(N)) 


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

int a[101][101] = {};

int main()
{
	int r, c;
	cin >> r >> c;
	for (int i = 0; i < r; i++)
	{
		for (int j = 0; j < c; j++)
		{
			cin >> a[i][j];
		}
	}
	//
	for (int i = 0; i < c; i++)
	{
		for (int j = 0; j < r; j++)
		{
			a[r][i] = a[r][i] + a[j][i];
		}
	}
	for (int i = 0; i < r+1; i++)
	{
		for (int j = 0; j < c; j++)
		{
			a[i][c] = a[i][c] + a[i][j];
		}
	}
	//
	for (int i = 0; i < r + 1; i++)
	{
		for (int j = 0; j < c+1; j++)
		{
			cout << a[i][j];
			if (j != c)
			{
				cout << " ";
			}
			else
			{
				cout << endl;
			}
		}
	}
	return 0;
}

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

int main(){
	int m, f, r, mandf;
	string o;
	while (1){
		cin >> m >> f >> r;
		mandf = (m >= 0 && f >= 0) ? m + f : (m >= 0) ? m : (f >= 0) ? f : 0;
		if (m == -1 && f == -1 && r == -1){
			break;
		}
		else if (m == -1 || f == -1){
			o += "F";
		}
		else if (mandf >= 80){
			o += "A";
		}
		else if (mandf >= 65){
			o += "B";
		}
		else if (mandf >= 50){
			o += "C";
		}
		else if (mandf >= 30){
			if (r >= 50){
				o += "C";
			}
			else{
				o += "D";
			}
		}
		else{
			o += "F";
		}
		o += "\n";
	}
	cout << o;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define mod7 1000000007

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int val, v;
	for (int i=0; i<5; i++) {
		cin>>val;
		if (val==0) v = i+1;
	}
	cout<<v<<'\n';
}



Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 1000000000000000
#define H 15
#define W 1100

ll h, w, k;
ll ans = INF;
vector<vector<ll>> whitel(H,vector<ll>(W,0));

void cntdiv(vector<vector<ll>> y, ll z){
	ll ansl = z;
	ll tate = y.size();
	REP(i,tate) REP(j,w) if (y[i][j]>k){
		return;
	}
	vector<ll> cnter(tate,0);
	REP(i,w){
		ll jud = false;
		REP(j,tate) cnter[j]+=y[j][i];
		REP(j,tate) if (cnter[j]>k){
			jud = true;
		}
		if (jud){
			ansl++;
			REP(j,tate) cnter[j]=y[j][i];
		}
	}
	//cout << ansl << endl;
	ans = min(ansl, ans);
	return;
}


int main(){
	cin >> h >> w >> k;
	REP(i,h){
		string s; cin >> s;
		REP(j,w){
			if (s[j]=='0') whitel[i][j]=0;
			else whitel[i][j]=1;
		}
	}
	vector<vector<ll>> cwhite;
	REP(i,(1ll<<h-1)){
		vector<ll> x(w,0);
		cwhite = {x};
		ll tatecnter = 0;
		REP(j,h){
			REP(l,w) cwhite.back().at(l)+=whitel[j][l];
			if ((i>>j)&1){
				tatecnter++;
				cwhite.pb(x);
			}
		}
		//cout << i << endl;
		cntdiv(cwhite,tatecnter);
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
def gen(n, l, m):
    l7 = list(map(lambda x: "7" + x, l))
    l5 = list(map(lambda x: "5" + x, l))
    l3 = list(map(lambda x: "3" + x, l))
    res = l7 + l5 + l3 + l
    m = m * 10 + 7
    if m > n:
        return res
    else:
        return gen(n, res, m)

n = int(input())
l = list(gen(n, [""], 0))
l = list(filter(lambda x : "7" in x and "5" in x and "3" in x, l))
l = list(set(l))
l = list(map(int, l))
l = list(filter(lambda x : x <= n, l))
print (len(l))

Measured memory_bytes: 92736
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	string w;
	cin>>w;
	int l=(int)w.length();
	int c[26];
	rep(i,26) c[i]=0;
	rep(i,26)rep(j,l)if(w[j]=='a'+i)c[i]++;
	bool bea=true;
	rep(i,26)if(c[i]%2==1)bea=false;
	if(bea)cout<<"Yes";
	else cout<<"No";
}

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

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);                      \
	cin.exceptions(cin.failbit);
#define int long long int //Comment when Unnecessary
#define ll long long
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define pii pair<int, int>
#define vi vector<int>
#define F first
#define S second
#define endl "\n" // Remove on Interactive

const int N = 300009;
const int mod = 1000000007;

int32_t main()
{
	IOS;
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vector<int> p(a), q(b), r(c);
	rep(i, 0, a)
	{
		cin >> p[i];
	}
	rep(i, 0, b)
	{
		cin >> q[i];
	}
	rep(i, 0, c)
	{
		cin >> r[i];
	}
	sort(all(p));
	sort(all(q));
	sort(all(r));
	reverse(all(p));
	reverse(all(q));
	reverse(all(r));
	vi khane;
	rep(i, 0, x)
	{
		khane.push_back(p[i]);
	}
	rep(i, 0, y)
	{
		khane.push_back(q[i]);
	}
	trav(it, r)
	{
		khane.push_back(it);
	}
	sort(all(khane));
	reverse(all(khane));
	int ans = 0;
	rep(i, 0, x + y)
	{
		ans += khane[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 8176
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(b/a, c) << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n;
    long long m;
    cin >> n >> m;
    vector<long long> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];

    long long ans = 0;
    long long x = 0;
    for(int i=0; i<=40; ++i){
        long long y = (m >> i << i) | x;
        if(y <= m){
            long long tmp = 0;
            for(int j=0; j<n; ++j)
                tmp += a[j] ^ y;
            ans = max(ans, tmp);
        }
        y &= ~(1 << i);
        if(y <= m){
            long long tmp = 0;
            for(int j=0; j<n; ++j)
                tmp += a[j] ^ y;
            ans = max(ans, tmp);
        }

        int cnt = 0;
        for(int j=0; j<n; ++j){
            if(a[j] & (1LL << i))
                ++ cnt;
        }
        if(cnt < n - cnt)
            x |= 1LL << i;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024