akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

struct UnionFind {
    vector<int> d;
    UnionFind(int n = 0): d(n, -1) {}
    int find(int x) {
        if (d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool smae(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};

int main() {
    int N, M; cin >> N >> M;
    UnionFind uf(N);
    for (int i = 0; i < M; i++) {
        int A, B; cin >> A >> B;
        A--, B--;
        uf.unite(A, B);
    }

    int ans = 0;
    for (int i = 0; i < N; i++) ans = max(ans, uf.size(i));
    cout << ans << endl;
    return 0;
}

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

const int INF=1e9+5;
const int N=3000+5;
const int mod=1e9+7;

ll dp[N][N];

int main(){
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
	// freopen("input.txt","r",stdin);
	int n;
	cin>>n;
	vector<int> a(n);
	for(int& x:a) cin>>x;
	for(int l=n-1;l>=0;--l){
		for(int r=l;r<n;++r){
			dp[l][r]=max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
		}
	}
	cout<<dp[0][n-1];
	return 0;
}
		


Measured memory_bytes: 70016
#include <iostream>
#include <map>
using namespace std;
using ll = long long;
const int INF = 1001001001;
const ll mod = 1000000007;
const int MAX = 1000100;

ll modpow(ll a, ll p){
    ll ret = 1;
    while(p){
        if(p & 1) ret = ret * a % mod;
        a = a * a % mod;
        p >>= 1;
    }
    return ret;
}

ll gcd(ll a, ll b){return (b == 0 ? a : gcd(b, a % b));}

int main(){
    int n; cin >> n;
    ll ans = 1, cnt = 0;
    map<pair<ll, ll>, pair<ll, ll>> mp;
    for(int i = 0; i < n; i++){
        ll a, b; cin >> a >> b;
        if(a == 0 && b == 0){
            cnt++;
            continue;
        }
        else if(a == 0){
            mp[{0, 1}].first++;
        }
        else if(b == 0){
            mp[{0, 1}].second++;
        }
        else{
            ll g = gcd(a, b);
            a /= g;
            b /= g;
            if(b < 0) a = -a, b = -b;
            if(a < 0){
                mp[{b, -a}].second++;
            }
            else mp[{a, b}].first++;
        }
    }

    for(auto P : mp){
        pair<ll, ll> p = P.second;
        ans = ans * (((modpow(2, p.first) - 1) + (modpow(2, p.second) - 1) + 1) % mod) % mod;
    }
    cout << (ans + cnt + mod - 1) % mod << endl;
}

Measured memory_bytes: 19200
/**
 *  @author: pr4shan7 (प्रशांत)
 */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pb_set;

// #define _DEBUG

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

#ifdef _DEBUG
  ifstream cin("input.txt");
  // ofstream cout("output.txt");
#endif

  int n;
  string s;
  cin >> n >> s;

  char ch = s[0];
  int cnt = 1;
  for (int i = 0; i < n; i++) {
    if (ch != s[i]) {
      cnt++;
      ch = s[i];
    }
  }

  cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

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

	vi x(n+1), y(m+1);
	x[0] = a;
	y[0] = b;
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}

	for (int i = 1; i <= m; i++) {
		cin >> y[i];
	}

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	if (y[0] - x[n] >0) {
		cout << "No War" << endl;
	}
	else {
		cout << "War" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<string>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<math.h>
#include<algorithm>
using namespace std;

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

int main()
{
    int N, K;
    // get a integer
    scanf( "%d", &N );
    scanf( "%d", &K );
    
    // nCk
    ll answer = K;
    for( int i = 1; i < N; ++i )
    {
        answer *= K - 1;
    }

    cout << answer << endl;
}



Measured memory_bytes: 256
using System;

namespace ITP1_8_A
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] str = Console.ReadLine().ToCharArray();
            for(int i = 0; i < str.Length; i++)
            {
                if (char.IsLower(str[i]))
                {
                    str[i] = char.ToUpper(str[i]);
                }
                else
                {
                    str[i] = char.ToLower(str[i]);
                }
            }
            Console.WriteLine(str);
        }
    }
}

Measured memory_bytes: 9200
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<tuple>
#include<utility>

using namespace std;



int main() {

	int n;
	cin >> n;

	vector<int> t(n);
	for (int i = 0; i < n; i++) {
		cin >> t.at(i);
	}

	int m;
	cin >> m;



	for (int i = 0; i < m; i++) {
		int p, x;
		cin >> p >> x;

		int a = t[p - 1];

		t[p - 1] = x;

		int sum = 0;

		for (int j = 0; j < n; j++) {
			sum += t.at(j);
		}

		t[p - 1] = a;

        cout << sum << endl;
	}





	return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	long long int a[100005];
	for (i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	for (i = 0; i < n; i++)
	{
		if (a[i] == 0)
		{
			printf("0\n");
			return 0;
		}
	}
	long long int ans = a[0];
	for (i = 1; i < n; i++)
	{
		if (1000000000000000000 / ans < a[i])
		{
			printf("-1\n");
			return 0;
		}
		ans *= a[i];
	}
	printf("%lld\n", ans);
	return 0;
}

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

#define int            long long int

using namespace std;
//char grid[1001][1001];
int32_t main()
{
    int h,w;
    cin>>h>>w;
    char grid[h+1][w+1];
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>grid[i+1][j+1];
        }
    }
    int dp[h+1][w+1];
    int give=1;
    dp[1][1]=1;
    for(int i=2;i<=w;i++)
    {
        if(grid[1][i]=='#')
            give=0;
        dp[1][i]=give;
    }
    give=1;
    for(int j=2;j<=h;j++)
    {
        if(grid[j][1]=='#')
            give=0;
        dp[j][1]=give;
    }
    for(int i=2;i<=h;i++)
    {
        for(int j=2;j<=w;j++)
        {
            if(grid[i][j]=='#')
                dp[i][j]=0;
            else
                dp[i][j]=(dp[i][j-1]+dp[i-1][j])%(1000000000+7);
        }
    }
    cout<<dp[h][w]<<endl;
}

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

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...)
#endif

namespace solver{
  void solve(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    
    int64_t N, K; std::cin >> N >> K;

    std::vector<int> P(N);
    for(int i = 0; i < N; ++i){
      std::cin >> P[i];
      P[i] -= 1;
    }

    std::vector<int64_t> C(N);
    for(int i = 0; i < N; ++i) std::cin >> C[i];

    int64_t ans = LLONG_MIN;

    for(int i = 0; i < N; ++i){
      int64_t cur = i;
      std::vector<int64_t> memo({0});
      int64_t cycle = 0;

      int64_t s = 0;
      do{
        cur = P[cur];
        s += C[cur];
        memo.push_back(s);
        ++cycle;
      }while(cur != i);

      dump(std::make_tuple(cycle, memo, s));

      if(s > 0){
        if(K % cycle == 0){
          if(K == cycle){
            int64_t t = *std::max_element(memo.begin() + 1, memo.end());
            ans = std::max(ans, t);
          }else{
            int64_t t = s * (K / cycle - 1) + *std::max_element(memo.begin(), memo.end());
            dump(t);
            ans = std::max(ans, t);
          }
        }else{
          int64_t t = s * (K / cycle) + *std::max_element(memo.begin(), memo.begin() + K % cycle + 1);
          dump(t);
          ans = std::max(ans, t);
        }
      }else{
        int64_t t = *std::max_element(memo.begin() + 1, memo.end());
        ans = std::max(ans, t);
      }
    }
    
    std::cout << ans << "\n";
  }
}

int main(){
  solver::solve();
  return 0;
}


Measured memory_bytes: 3828
# coding: utf-8
n = int(input())
A = list(map(int, input().split()))
X = [0]*(n+1)
for a in A:
    X[a] += 1
s = 0
for x in X:
    s += x*(x-1)//2
for a in A:
    print(s-X[a]+1)

Measured memory_bytes: 25644
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <cmath>
#include <string>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define lowbit(x) (x &(-x))
#define me(ar) memset(ar, 0, sizeof ar)
#define mem(ar,num) memset(ar, num, sizeof ar)
#define rep(i, a, n) for(int i = a; i <= n; i ++)
#define pre(i, n, a) for(int i = n; i >= a; i --)
#define rp(i, n) for(int i = 0, i < n; i ++)
using namespace std;
typedef long long ll;
const int  INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-10;
const ll   mod = 1e9 + 7;
const int  N = 2e5 + 5;

signed main(void)
{
   int a, b, c;
   cin >> a >> b >> c;
   if(a == b && b != c || a == c && c != b || b == c && c != a) cout << "Yes" << endl;
   else cout << "No" << endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
  map<string, int> m;
  int flg=0;
  int N;
  cin >> N;
  for(int i=0; i<N; ++i){
    string s;
    cin >> s;
    ++m[s];
    flg = max(m[s], flg);
  }
  for(auto const& entry: m){
    if(entry.second == flg) cout << entry.first << endl;
  }
}

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

using namespace std;

#define INF 210000000
#define int long long

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

int lcm(int a, int b) { return a * b / gcd(a, b); }

signed main() {
		int a,b;
		cin >> a >> b;
		vector<int> p;
		p.push_back(a + b);
		p.push_back(a - b);
		p.push_back(a * b);
		sort(p.begin(),p.end());
		cout << p[2];
}



Measured memory_bytes: 256
from collections import deque


def main():
    while True:
        n, m = [int(i) for i in input().split()]
        if n == 0 and m == 0:
            return
        _, *a = [int(i) for i in input().split()]
        _, *b = [int(i) for i in input().split()]
        _, *c = [int(i) for i in input().split()]
        a.insert(0, 0)
        b.insert(0, 0)
        c.insert(0, 0)

        q = deque()
        q.appendleft([a, b, c, 0, -1])
        tmp = [i for i in range(0, n+1)]

        while q:
            # d はカウンタ
            a, b, c, d, t = q.pop()
            """
            print(a)
            print(b)
            print(c)
            print('=======')
            """
            # 終了
            if d > m:
                print(-1)
                break
            if a == tmp or c == tmp:
                print(d)
                break
            # a から b
            if a[-1] > b[-1] and t != 1 and t != 0:
                q.appendleft([a[:-1], b+[a[-1]], c[:], d+1, 0])
            # b から a
            if b[-1] > a[-1] and t != 0 and t != 1:
                q.appendleft([a+[b[-1]], b[:-1], c[:], d+1, 1])
            # b から c
            if b[-1] > c[-1] and t != 3 and t != 2:
                q.appendleft([a[:], b[:-1], c+[b[-1]], d+1, 2])
            # c から b
            if c[-1] > b[-1] and t != 2 and t != 3:
                q.appendleft([a[:], b+[c[-1]], c[:-1], d+1, 3])


if __name__ == '__main__':
    main()


Measured memory_bytes: 6012
"use strict";
function I(s,f){this._s=s.split("\n");this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s[this._l];if(!l)return;this._c=0;this._l++;return l.split(" ").map(this._f)};module.exports=I;

function main(input) {
  const o = new I(input);

  const N = o.a();
  const C = [];
  for (let i = 0; i < N; i++) {
    let cn = o.a();
    C.push(cn);
  }

  const prevPos = {};
  let results = [1];
  prevPos[C[0]] = 0;

  for (let i = 1; i < N; i++) {
    if (C[i] === C[i-1]) {
      results[i] = results[i-1];
    } else {
      let prev = prevPos[C[i]];

      if (prev !== undefined) {
        results[i] = (results[i-1] +  results[prev] ) % 1000000007;
      } else {
        results[i] = results[i-1];
      }
    }
    prevPos[C[i]] = i;
  }

  console.log(results[N-1]);
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 63932
import java.util.*;

public class Main {
    static int max = 100000;
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        function(n);
    }
    
    private static void function(int n) {
        int [] count = new int [max+1];
        for(int i = 0; i < count.length; i++) {
            count[i] = i;
        }
        List<Integer> list = new ArrayList<>();
        multiply(list,6);
        multiply(list,9);
        
        for(int i = 0; i < count.length; i++) {
            for(int j = 0; j < list.size(); j++) {
                int tmp = list.get(j);
                if(i+tmp <= max) {
                    count[i+tmp] = Math.min(count[i+tmp], count[i]+1);
                }
            }
        }
        System.out.println(count[n]);
    }
    
    private static void multiply(List<Integer> list, int num) {
        int x = num;
        while(x <= max) {
            list.add(x);
            x *= num;
        }
    }
}

Measured memory_bytes: 22356
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;



       cin>>n;

       if(n==1)cout<<n<<endl;

       else
       {
           b=sqrt(n);



           for(j=2; j<=b; j++)
           {
               a=j;

              // cout<<a*a<<" "<<n<<endl;

               for(i=a*a; i<=n; i*=a)
               {


                   cnt=max(cnt,i);
               }
           }

           cout<<cnt<<endl;
       }











}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 10004;

int n;
int ans[N];

void solv()
{
    scanf("%d", &n);
    for (int x = 1; x <= 100; ++x)
    {
        for (int y = 1; y <= 100; ++y)
        {
            for (int z = 1; z <= 100; ++z)
            {
                int u = x * x + y * y + z * z + x * y + y * z + z * x;
                if (u < N)
                    ans[u]++;
            }
        }
    }
    for (int i = 1; i <= n; ++i)
        printf("%d\n", ans[i]);
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


Measured memory_bytes: 3756
import java.lang.Math.pow
import kotlin.math.sqrt

fun main(args: Array<String>) {
    val N = readInt()
    val rootN = sqrt(N.toDouble()).toInt() + 1
    var list = MutableList<Int>(N + 1) { 0 }

    // x
    for (x in 1..rootN) {
        // y
        for (y in 1..rootN) {
            // z
            for (z in 1..rootN) {
                val sahen = (pow(x.toDouble(), 2.0) + pow(y.toDouble(), 2.0) + pow(z.toDouble(), 2.0) +
                        x * y + y * z + z * x).toInt()
                if (sahen <= N) {
                    list[sahen]++
                }
            }
        }
    }
    for (i in 1 .. N) {
        println(list[i])
    }

}


private fun read() = readLine()!!

private fun readInt() = read().toInt()

private fun readLong() = read().toLong()

private fun readDouble() = read().toDouble()

private fun readStringList(): MutableList<String> = read().split(" ").toMutableList()

private fun readIntList(): MutableList<Int> = readStringList().map { it.toInt() }.toMutableList()

private fun readLongList(): MutableList<Long> = readStringList().map { it.toLong() }.toMutableList()

private fun readDoubleList(): MutableList<Double> = readStringList().map { it.toDouble() }.toMutableList()

private fun readStringMatrix(n: Int): MutableList<MutableList<String>> {
    val matrix = mutableListOf<MutableList<String>>()
    for (i in 0 until n) {
        val list = readStringList()
        matrix.add(list)
    }
    return matrix
}

private fun readIntMatrix(n: Int): MutableList<MutableList<Int>> {
    val matrix = mutableListOf<MutableList<Int>>()
    for (i in 0 until n) {
        val list = readIntList()
        matrix.add(list)
    }
    return matrix
}

private fun readDoubleMatrix(n: Int): MutableList<MutableList<Double>> {
    val matrix = mutableListOf<MutableList<Double>>()
    for (i in 0 until n) {
        val list = readDoubleList()
        matrix.add(list)
    }
    return matrix
}

private fun readLongMatrix(n: Int): MutableList<MutableList<Long>> {
    val matrix = mutableListOf<MutableList<Long>>()
    for (i in 0 until n) {
        val list = readLongList()
        matrix.add(list)
    }
    return matrix
}



Measured memory_bytes: 37608
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void solve(){
  ll x,k,d;
  cin>>x>>k>>d;
  x=abs(x);
  if(x>0){
    ll num=x/d;
    if(k<=num+1){
      cout<<abs(x-k*d)<<endl;
      return;
    }
    else{
      ll ans=LLONG_MAX;
      ll left= k-num;
      if(left%2==0){
        ans=min(ans,abs(x-num*d));
      }
      else{
        ans=min(ans,abs(x-(num+1)*d));
      }

      left= k-(num+1);
      if(left%2==0){
        ans=min(ans,abs(x-(num+1)*d));
      }
      else{
        ans=min(ans,abs(x-(num)*d));
      }
      cout<<ans<<endl;
    }
  }
  else{
    if(k%2==0){cout<<0<<endl;}
    else{
      cout<<d<<endl;
    }
  }
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3652
n,m=map(x->parse(Int,x),split(readline()))
a=[]
b=[]
for i=1:n
	push!(a,map(x->parse(Int,x),split(readline())))
end
for i=1:m
	push!(b,map(x->parse(Int,x),split(readline())))
end
for i=1:n
	x,y=a[i]
	c=map(X->abs(x-X[1])+abs(y-X[2]),b)
	println(find(c.==minimum(c))[1])
end

Measured memory_bytes: 173316
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H, W;
  cin >> H >> W;
  char a[H][W];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> a[i][j];
    }
  }
  for(int i=0;i<W+2;i++) cout << "#";
  cout << endl;
  for(int i=0;i<H;i++){
    cout << "#";
    for(int j=0;j<W;j++){
      cout << a[i][j];
    }
    cout << "#" << endl;
  }
  for(int i=0;i<W+2;i++) cout << "#";
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>

using namespace std;

#define mod (1e9 + 7)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()

typedef long long ll;

void solve1()
{
    ll n, a, b, c, d, e; cin >> n >> a >> b >> c >> d >> e;
    ll ans = 5 + n/min({a, b, c, d, e});
    cout << min(ans, 5 + n - 1) << endl;
}

int main()
{
    solve1();
}

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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);
// lambda: [](T1 x)->T2{return y;}
// simple lambda: [](T x){return x;}

int main(void) {
    int N, D;
    string src;
    cin >> N >> src >> D;

    string dst(src);

    int cnt = 0;
    rep(i, N) {
        if (cnt >= D) break;
        if (src[i] == '0') {
            dst[i] = '1';
            ++cnt;
        }
    }

    rep(i, N) {
        if (cnt >= D) break;
        int j = N - i - 1;
        if (src[j] == '1') {
            dst[j] = '0';
            ++cnt;
        }
    }

    cout << dst << endl;

	return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
char s1[10000],s2[10000];
int main() {
	gets(s1);
	gets(s2);
	int len1=strlen(s1);
	int len2=strlen(s2);
	sort(s1,s1+len1);
	sort(s2,s2+len2);
	for(int i=0; i<fmax(len1,len2); i++) {
		if(s1[i]<s2[len2-i-1]) {
			cout<<"Yes"<<endl;
			return 0;
		}
		if(s1[i]>s2[len2-i-1])
			break;
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<cmath>
using namespace std;

typedef pair<int, int> P;
typedef long long ll;
const int INF = 100000000;

ll gcd( ll a, ll b ){
    ll tmp;
    if( a < b ) { tmp = a; a = b; b = tmp; }
    if( b < 1 ) return -1;

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

ll lcm(ll a, ll b){
    return a * b / gcd(a, b);
}


//入力
int n, x;
int l[110];
int d[10010];


int main(){

    cin >> n >> x;
    for(int i = 1; i <= n; i++){
        cin >> l[i];
    }

    d[1] = 0;
    for(int i = 2; i <= n+1; i++){
        d[i] = d[i-1] + l[i-1];
    }

    for(int i = 1; i <= n+1; i++){
        if(d[i] == x){
            cout << i << endl;
            return 0;
        }
        if(d[i] > x){
            cout << i - 1 << endl;
            return 0;
        }
    }

    cout << n + 1 << endl;

    return 0;
}

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

const int mod = 1000000007;

struct modint{
    //member variable

    long long x;

    //constructor

    modint(long long x = 0):x((x%mod+mod)%mod){}

    //operator

    modint& operator+=(const modint ob){
        if((x += ob.x) >= mod) x -= mod;
        return *this;
    }

    modint& operator-=(const modint ob){
        if((x += mod - ob.x) >= mod) x -= mod;
        return *this;
    }

    modint& operator*=(const modint ob){
        (x *= ob.x) %= mod;
        return *this;
    }

    modint operator+(const modint ob) const {
        modint res(*this);
        return res+=ob;
    }

    modint operator-(const modint ob) const {
        modint res(*this);
        return res-=ob;
    }

    modint operator*(const modint ob) const {
        modint res(*this);
        return res*=ob;
    }

    modint pow(long long index) const {
        if(!index){
            modint ob(1);
            return ob;
        }
        modint ob = pow(index>>1);
        ob *= ob;
        if(index&1) ob *= *this;
        return ob;
    }

    //for prime mod
    modint inverse() const {
        return pow(mod-2);
    }

    modint& operator/=(const modint ob){
        return (*this) *= ob.inverse();
    }

    modint operator/(const modint ob) const {
        modint res(*this);
        return res/=ob;
    }
};

struct combination{
    //member variable
    vector<modint> fact, invfact;

    //constructor
    combination(int n):fact(n+1),invfact(n+1){
        fact[0] = 1;
        for(int i=1; i<=n; i++){
            fact[i] = fact[i-1]*i;
        }
        invfact[n] = fact[n].inverse();
        for(int i=n; i>=1; i--){
            invfact[i-1] = invfact[i]*i;
        }
    }

    modint operator()(int n, int k){
        if(k < 0 || k > n) return 0;
        return fact[n]*invfact[k]*invfact[n-k];
    }
};

int main(){
    long long n, a, b;
    cin >> n >> a >> b;
    modint an(1),ans(2LL);
    an = ans.pow(n);
    modint ca(1), cb(1);
    for(int i = n-a+1; i <=n ; i++){
        ca *= i;
    }
    for(int i = 1; i <=a ; i++){
        ca /= i;
    }
    for(int i = n-b+1; i <=n ; i++){
        cb *= i;
    }
    for(int i = 1; i <=b ; i++){
        cb /= i;
    }
    an -= ca;
    an -= cb;
    an -= 1;
    cout << an.x << endl;
    return 0;
}

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

//2つの正数を渡した時にその各位の話を返す関数
int DigitsSum(int a, int b) {
    int sum = 0;
    while (a != 0) {
        sum += (a % 10);
        a = a / 10;
    }
    while (b != 0) {
        sum += (b % 10);
        b = b / 10;
    }
    return sum;
}


int main() {
    int n;
    int min = 1000;

    cin >> n;

    for (int i = 1; i < n; i++) {
        if (DigitsSum(i, n - i) < min) {
            min = DigitsSum(i, n - i);
        }
    }

    cout << min << endl;

    return 0;
}

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

static const long long mod = 1000000007LL;
int n;
char str[100005];
int long long dp[100005][13];

int main() {
    cin >> str;
    n = strlen(str);
    int i, j, ki; 
    int long long res = 0;
    // dp[i][j] = 先頭i文字として考えられるもののうち，
    // 13で割ったあまりがjであるものの個数
    
    dp[0][0] = 1;
    for (i=0;i<n;++i) {
        int c;
        if (str[i]=='?') c = -1;
        else c = str[i] - '0';

        for (j=0;j<10;++j) {    // cの数字が決まっている時はその数字，決まっていない時は全通り
            if (c != -1 && c != j) continue;
            for (ki=0;ki<13;++ki) {
                dp[i+1][(ki*10+j)%13] += dp[i][ki];
            }
        }
        for (j=0;j<13;++j) {
            dp[i+1][j] %= mod;
        }
    }
    res = dp[n][5];
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 10496
#include<stdio.h>
int main()
{
	int a,b,n,x,y;
	while(scanf("%d%d",&a,&b),a)
	{
		int k[17][17]={0},r[17][17]={0};
		scanf("%d",&n);
		while(n--)scanf("%d%d",&x,&y),k[x][y]=1;
		for(x=n=1;x<=a;++x)r[x][1]=(k[x][1]?n=0:n);
		for(y=n=1;y<=b;++y)r[1][y]=(k[1][y]?n=0:n);
		for(x=2;x<=a;++x)for(y=2;y<=b;++y)if(!k[x][y])r[x][y]=r[x-1][y]+r[x][y-1];
		printf("%d\n",r[a][b]);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
string a;
int n;
int main() {
	cin>>a;
	n = a.size()/2 - 1;
	for(int i=a.size()/2-1; ; i--)
		if(a.substr(0, i)==a.substr(i, i)) {cout<<i*2; return 0;}
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int ans = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) != T.at(i)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3808
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n; cin >> n;
    int a[100001]={};
    int t1=6, t2=9;
    for(int i = 1; i <= n; i++){
        a[i] = i;
    }
    
    while(1){
        for(int i = 0; i<=n; i++){
            if(i+t1>n){
                break;
            } else{
                if(a[i+t1] > a[i]+1){
                    a[i+t1] = a[i]+1;
                }
            }
        }
        for(int i = 0; i<=n; i++){
            if(i+t2>n){
                break;
            } else{
                if(a[i+t2] > a[i]+1){
                    a[i+t2] = a[i]+1;
                }
            }
        }
        t1*=6;
        t2*=9;
        if(t1>n && t2>n) break;
    }
    cout << a[n];
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s1 = in.next();
		String sFirst = s1.substring(0, (s1.length() - 1) / 2);
		String sSecond = s1.substring((s1.length() + 1) / 2, s1.length());
		char[] c1 = s1.toCharArray();
		char[] c2 = new char[s1.length()];
		for (int i = 0; i < s1.length(); i++) {
			c2[i] = c1[(s1.length() - 1) - i];
		}
		String s2 = String.valueOf(c2);
		
		System.out.println(s1.equals(s2) && sFirst.equals(sSecond) ? "Yes" : "No");
	}
}	

Measured memory_bytes: 22868
n, m, x = map(int, input().split())

price = []
ability = []
for _ in range(n):
  lst = []
  lst = [int(i) for i in input().split()]
  price.append(lst[0])
  ability.append(lst[1:m + 1])
#print(price)
#print(ability)
min_price = float('inf')
for i in range(2 ** n):
  flag = True
  total = 0
  obtain = [0] * m
  for j in range(n):
    if ((i >> j) & 1):
      total += price[j]
      for k in range(m):
        obtain[k] += ability[j][k]
  for j in range(m):
    if obtain[j] < x:
      flag = False
      break
  if flag:
    if total < min_price:
      min_price = total
if min_price == float('inf'):
  print(-1)
else:
  print(min_price)

Measured memory_bytes: 9248
function main(input){
    inputI = input.split(' ');
    count=0
    out='No';
    if(parseInt(inputI[0])==parseInt(inputI[1])){
        count++;
    }
    if(parseInt(inputI[0])==parseInt(inputI[2])){
        count++;
    }
    if(parseInt(inputI[1])==parseInt(inputI[2])){
        count++;
    }
    if(0<count && count<3){
        out='Yes';
    }
    console.log(out);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
/***

   Author : Md. Jashim Uddin
   From   : RMSTU

 ***/
#include<bits/stdc++.h>
using namespace std;
#define     sf(a)           scanf("%d",&a)
#define     sff(a,b)        scanf("%d %d",&a,&b)
#define     sfff(a,b,c)     scanf("%d %d %d",&a,&b, &c)
#define     pb              push_back
#define     ll              long  long int
#define     fast            ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define     pi              2*acos(0)
#define     sp              fixed<<setprecision
#define     lcm(a,b)        (a*b)/gcd(a,b)
#define     gcd(a,b)        _gcd(a,b)
#define     forn(i,n)       for(int i=1;i<=n;i++)
#define      mx               10001
int main()
{
     ll n,k;
     cin>>n>>k;
     char s[50],ch;
     for(int i=0;i<n;++i)cin>>s[i];
     for(int i=0;i<n;++i)
     {
         if(i==k-1)
         {
            ch = tolower(s[i]);
             cout<<ch;
         }
         else cout<<s[i];

     }





    return 0;
}


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

using namespace std;

typedef long long LL;

const int mod=1e9+7;

map<LL,LL>mp;

LL n,k;

LL qsm(LL a,LL b) 
{
	LL res=1;
	while(b) {
		if(b&1) res=res*a%mod;
		b>>=1;
		a=a*a%mod;
	}
	return res;
}

int main()
{
	
	cin>>n>>k;
	
	for(int i=k;i>=1;i--) {
		LL res=0;
		res=qsm(k/i,n);
		int bei=2;
		while(bei*i<=k) res-=mp[bei*i],bei++;
		mp[i]=res%mod;
	}
	//cout<<"----"<<mp[1]<<'\n';
	LL sum=0;
	for(LL i=1;i<=k;i++) {
		sum=(sum+(LL)i*mp[i]%mod)%mod;
	}
	cout<<sum%mod<<'\n';
	
	return 0;
}

//12927461

Measured memory_bytes: 9892
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N,K = IL()
T = ILs(N)

T.sort()

print(min( T[i+K-1]-T[i] for i in range(N-K+1)))
  


Measured memory_bytes: 44892
#include<iostream>
#include<queue>
#include<algorithm>
#include<cstring>
#define r first
#define c second
using namespace std;
typedef pair<int, int> Point;
const int BUF = 25;


int row, col;
bool isWall[BUF][BUF];

void read() {
    cin >> row >> col;
    for (int i = 0; i < row; ++i) {
        for (int j = 0; j < col; ++j) {
            char ch;
            cin >> ch;
            isWall[i][j] = ch == '#';
        }
    }
}


int bfs(int initR, int initC) {
    queue<Point> Q;
    int cost[BUF][BUF] = {};
    
    Q.push(Point(initR, initC));
    memset(cost, -1, sizeof(cost));
    cost[initR][initC] = 0;

    while (!Q.empty()) {
        Point cur = Q.front();
        Q.pop();

        static int dr[] = {-1, 0, 1, 0};
        static int dc[] = {0, 1, 0, -1};

        for (int i = 0; i < 4; ++i) {
            int nr = cur.r + dr[i];
            int nc = cur.c + dc[i];
            if (!(0 <= nr && nr < row && 0 <= nc && nc < col)) continue;
            if (isWall[nr][nc]) continue;
            if (cost[nr][nc] != -1) continue;
            cost[nr][nc] = cost[cur.r][cur.c] + 1;
            Q.push(Point(nr, nc));
        }
    }

    int maxV = 0;
    for (int i = 0; i < row; ++i) {
        for (int j = 0; j < col; ++j) {
            maxV = max(maxV, cost[i][j]);
        }
    }
    return maxV;
}


void work() {
    int maxV = 0;
    for (int i = 0; i < row; ++i) {
        for (int j = 0; j < col; ++j) {
            if (!isWall[i][j]) {
                maxV = max(maxV, bfs(i, j));
            }
        }
    }
    cout << maxV << endl;
}


int main() {
    read();
    work();
    return 0;
}


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

using ll = long long;

using namespace std;
#define int ll

//0 -> a-1
#define rep(i, a) for (int i = 0; (i) < (int)(a); (i)++)
//a -> b-1
#define reps(i, a, b) for (int i = (int)(a); (i) < (int)(b); (i)++)
//a-1 -> 0
#define rrep(i, a) for (int i = (int)a - 1; (i) >= 0; (i)--)
//a-1 -> b
#define rreps(i, a, b) for (int i = (int)(a)-1; (i) >= (int)(b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
//next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
(v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v) \
	sort(all(v)); \
	(v).erase(unique(all(v)), v.end())
#define CIN(type, x) \
	type x;          \
	cin >> x
#define YES(f) if ((f)) {cout << "YES" << endl;} else {cout << "NO" << endl;}
#define Yes(f) if ((f)) {cout << "Yes" << endl;} else {cout << "No" << endl;}
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
//b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
//c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(12)
#define RS resize
#define CINV(v, N)             \
	do                         \
	{                          \
		v.RS(N);               \
		rep(i, N) cin >> v[i]; \
	} while (0);

#define RCINV(v, N)             \
	do                          \
	{                           \
		v.RS(N);                \
		rrep(i, N) cin >> v[i]; \
	} while (0);
#define MOD 1000000007

template <class T>
inline T GET()
{
	T x;
	cin >> x;
	return x;
}

void init();
void solve();

signed main()
{
	init();
	solve();
}

void init()
{
	int a, b ,c;
	cin >> a >> b >> c;
	Yes(a == b && b == c);
}

void solve()
{
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace 
std;int main() {
  int N,half;
  bool flag = true;
  cin>>N;
  
  if(N%2 == 1){
    flag = false;
  }
  
  vector<char> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  
  half = N/2;
  for(int i = 0; i < half; i++){
    if(A.at(i) == A.at(i + half)){
      continue;
    }
    else{
      flag = false;
      break;
    }
  }
  if(flag == true){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define hell 1000000007
using namespace std;
const int N=500;
void solve()
{
    ll i,j,k,n,m,c=0,ans=0;
    string s;
    cin>>n;
    n%=1000; ll a;
    a=1000;
    a-=n;
    a%=1000;
    cout<<a;





}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    solve();
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  string s;
  cin>>s;
  vector<int> vec(26,0);
  rep(i,s.size()){
    vec[s[i]-'a']++;
  }
  string ans="Yes";
  rep(i,26){
    if(vec[i]%2!=0){
      ans="No";
    }
  }
  cout<<ans<<endl;
}

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

#define ll long long
#define F first
#define S second
#define ii pair < int , int >
#define ever (;;)

const int N = 300100;

int n,m,k,ans;
map <int,int> row,col;
vector <int> v[N];
multiset <int> s;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=k;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        row[x]++;
        col[y]++;
        v[x].push_back(y);
    }

    for(auto x:col)
        s.insert(x.S);

    for(auto X:row)
    {
        int mx = 0;

        for(auto x:v[X.F])
        {
            s.erase(s.find(col[x]));
            s.insert(col[x]-1);
        }

        ans = max( ans , X.S + (*s.rbegin()) );

        for(auto x:v[X.F])
        {
            s.erase(s.find(col[x]-1));
            s.insert(col[x]);
        }
    }

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


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

LL n,ans,cnt;

int main()
{
	
	cin>>n;
	cnt=1;
	while(n)
	{
		ans+=cnt;
		n>>=1;
		cnt<<=1;
	}
	cout<<ans<<'\n';
		
	return 0;
}

Measured memory_bytes: 256
def f(a, b)
  gap = b - a

  t = 1
  while t * 2 <= gap
    t *= 2
  end

  a, b = -b, -a if b % t == 0
  c = (b / t) * t
    
  if b == c
    1
  else
    f(a, c) + f(c, b)
  end
end

n = STDIN.gets.to_i
n.times do
  s, d = STDIN.gets.split.map(&:to_i)
  p f(s, d)
end

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

int a[100006];
struct lin{
    int num;
    int value;
};
lin b[100006];

bool cmp(lin a,lin b){
    return a.value>b.value;
}

int main(){
    int n;
    int m;
    cin>>n>>m;
    long long sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    sort(a,a+n);
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        b[i].num=x;
        b[i].value=y;
    }
    sort(b,b+m,cmp);
    long long j=0;
    long long k=0;
    for(int i=0;i<m;i++){
        k=j+b[i].num;
        for(j;j<k;j++){
            //cout<<"j="<<j<<" value="<<b[i].value<<" a[j]="<<a[j]<<endl;
            if(a[j]>=b[i].value||j>=n){
                k=-1;
                break;
            }
            sum=sum-a[j]+b[i].value;
        }
        if(k==-1) break;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1408
n, m = gets.split(' ').map(&:to_i)

arr = []
n.times do
  x, y, z = gets.split(' ').map(&:to_i)
  arr << [x, y, z]
end

if m == 0
  puts 0
else
  fs = [
    ->(x,y,z) { x+y+z },
    ->(x,y,z) { -x+y+z },
    ->(x,y,z) { x-y+z },
    ->(x,y,z) { x+y-z },
    ->(x,y,z) { x-y-z },
    ->(x,y,z) { -x+y-z },
    ->(x,y,z) { -x-y+z },
    ->(x,y,z) { -x-y-z }
  ]

  h = {}

  fs.each_with_index do |f, i|
    h[i] = arr.inject([]) do |acc, (x,y,z)|
      acc << f.call(x, y, z)
    end.sort!.reverse!.slice!(0, m).inject(:+)
  end

  puts h.values.max
end


Measured memory_bytes: 2040
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<chrono>
#define MAX_N 100
#define MAX_M 100
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
 
 
int main(){
    int a;
    cin>>a;
    int b=a*a;
    cout<<b;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N;
	cin >> N;
	vector <int> p(N, 0);
	int cnt = 0;
	for (int ii = 1; ii <= N; ++ii){
		int tmp;
		cin >> tmp;
		if (tmp != ii){
			cnt++;
		}
	}

	if (cnt <= 2){
		cout << "YES" << "\n";
	} else {
		cout << "NO" << "\n";

	}



	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;

string S[2002];
int P[2002][2002], A[2002][2002], B[2002][2002];

int main() {
    if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0);

    int N, M, Q; cin >> N >> M >> Q;
    for (int i = 0; i < N; ++i) cin >> S[i];

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            P[i+1][j+1] = P[i+1][j]+P[i][j+1]-P[i][j]+(S[i][j]=='1');
            if (i) A[i+1][j+1] = A[i+1][j]+A[i][j+1]-A[i][j]+(S[i][j]=='1'&&S[i-1][j]=='1');
            if (j) B[i+1][j+1] = B[i+1][j]+B[i][j+1]-B[i][j]+(S[i][j]=='1'&&S[i][j-1]=='1');
        }
    }
    
    while (Q--) {
        int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
        cout << P[x2][y2]-P[x1-1][y2]-P[x2][y1-1]+P[x1-1][y1-1]
               -A[x2][y2]+A[x1  ][y2]+A[x2][y1-1]-A[x1  ][y1-1]
               -B[x2][y2]+B[x1-1][y2]+B[x2][y1  ]-B[x1-1][y1  ] << '\n';
    }
}

Measured memory_bytes: 54612
#include <bits/stdc++.h>
using namespace std;
//動画解答例
long long INF=1e18;
long long dp[200005][4];
int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  int k=1+n%2;
  for(int i=0;i<n+1;i++){
    for(int j=0;j<k+1;j++){
      dp[i][j]=-INF;
    }
  }
  dp[0][0]=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<k+1;j++){
      dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]);
      long long tmp=dp[i][j];
      if((i+j)%2==0)tmp+=a[i];
      dp[i+1][j]=max(dp[i+1][j],tmp);
    }
  }
  cout<<dp[n][k]<<endl;
  return 0;
}

Measured memory_bytes: 10364