akhauriyash/Code-Regression huggingface dataset:
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef vector<pii>vip;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 10000000;
ll divcnt[maxn];
void DivisorCount(){
    for(int i = 1; i<=maxn; i++){
        for(int j  = i; j<=maxn; j+=i){
            divcnt[j]++;
        }
    }
}

int main(){
        _
        DivisorCount();
        ll n; cin >> n;
        ll ans = 0;
        for(ll k  = 1; k<=n; k++){
            ans+=(k*divcnt[k]);
        }
        cout << ans << endl;

return 0;
}



Measured memory_bytes: 81756
//#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define ll long long int
#define ld long double
#define vec vector
#define forn(a) for(ll a=0; a<n; a++)
#define all(x) x.begin(), x.end()
#define deb(x) cerr<<#x<<" = "<<x<<endl
 
using namespace std;
 
int main() {
    IOS;
    cout.precision(20);

    int n; cin>>n;
    vec<ld> v(n);
    forn(i) cin>>v[i];

    ld res = 0.0;
    for(auto it: v) res += 1.0/it;

    cout<<1.0/res<<endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)

	// var n, k int
	// fmt.Scan(&n, &k)
	n := nextInt()
	k := nextInt()
	as := make([]int, n)
	for i := 0; i < n; i++ {
		// fmt.Scan(&as[i])
		as[i] = nextInt()
	}

	var stop bool
	rs := as
	for i := 0; i < k; i++ {
		rs, stop = action(rs)
		if stop {
			break
		}
	}

	for i := 0; i < n; i++ {
		if i < n-1 {
			fmt.Printf("%d ", rs[i])
		} else {
			fmt.Println(rs[i])
		}
	}
}

func action(as []int) ([]int, bool) {
	n := len(as)
	// rs := make([]int, n)
	// for i := 0; i < n; i++ {
	// 	a := as[i]
	// 	for j := i - a; j <= i+a; j++ {
	// 		if 0 <= j && j < n {
	// 			rs[j]++
	// 		}
	// 	}
	// }

	cnt := 0
	d := make([]int, n+1)
	for i := 0; i < n; i++ {
		a := as[i]
		l := max(0, i-a)
		r := min(i+a+1, n)
		d[l]++
		d[r]--

		if a == n {
			cnt++
		}
	}

	s := make([]int, len(d)+1)
	for i := 0; i < n; i++ {
		s[i+1] = s[i] + d[i]
	}

	rs := make([]int, n)
	for i := 0; i < n; i++ {
		rs[i] = s[i+1]
	}
	return rs, cnt == n
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 13116
N = input()
A = map(int,raw_input().split())
 
for i in range(N-1):
    print A[i],
print A[-1]
 
for i in range(1,N):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    for i in range(N-1):
        print A[i],
    print A[-1]


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

int64_t calc(int64_t X){
    int64_t ret = 0;
    int64_t st = X/4*4;
    for(int64_t x=st; x<=X; x++) ret ^= x;
    return ret;
}

int main(){
    int64_t A, B;
    cin >> A >> B;
    int64_t ans = calc(A-1) ^ calc(B);
    cout << ans << endl;
    return 0;
}


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

#define int long long int
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int cmod = 998244353;
const int N = 4e5 + 5;
const int inf = 1e16 + 2;

double cp[301][301][301];
int vis[301][301][301] , a[4] , n;
double dp(int a , int b , int c) {
    if(a < 0 or b < 0 or c < 0 ) return 0;
    if(a == 0 and b == 0 and c == 0) return 0;
    double &ans = cp[a][b][c];
    if(vis[a][b][c]) return ans;
    vis[a][b][c] = 1;
    ans = n + a * dp(a - 1 , b , c) + b * dp(a + 1 , b - 1 , c) + c * dp(a , b + 1 , c - 1);
    ans /= (a + b + c);
    return ans;
}
void solve(int Case) {
    cin >> n;
    for(int i = 0 , ok ; i < n ; i ++) cin >> ok , a[ok] ++;
    cout << fixed << setprecision(12) << dp(a[1] , a[2] , a[3]) << '\n';
}
/*
 */

int32_t main()
{
    fastio
    int testcase = 1;
    //cin >> testcase;
    int Case = 1;
    while(testcase --) {
        solve(Case ++);
    }
    return 0;
}
 



Measured memory_bytes: 218604
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int n , k; cin >> n >> k;
	vector<bool> check(n,true);
	for(int i = 0;i<k;++i)
	{
		int d;cin >> d;
		while(d--)
		{
			int x;cin >> x;
			check[x-1] = false;
		}
	}
	int ans = 0;
	for(auto x:check)
		if(x) ans++;
	cout<<ans<<"\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

int main() {
  vector<int> m(5);
  rep(i, 5) cin >> m[i];
  int ans = 0;
  int x = 0;
  rep(i, 5) {
    int y = 0;
    while (m[i]%10 != 0) {
      m[i]++;
      y++;
    }
    ans += m[i];
    x = max(x, y);
  }
  ans -= x;
  cout << ans << endl;
}

Measured memory_bytes: 256
from fractions import gcd


def f(a, m, n):
    l = m * n // gcd(m, n)
    return a - (a // m) - (a // n) + a // l


def main():
    a, b, c, d = map(int, input().split())
    print(f(b, c, d) - f(a - 1, c, d))


if __name__ == "__main__":
    main()


Measured memory_bytes: 5088
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifndef U_L_LONG
typedef unsigned long long ULLONG;
#endif
#ifndef L_LONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstr(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}

static void ABC097C_KthSubstring();

#if 1
int main()
{
	ABC097C_KthSubstring();
	fflush(stdout);
	return 0;
}
#endif

static void ABC097C_KthSubstring()
{
	int K;
	char szS[5001] = { 0 };
	getstr(szS);
	get1int(K);
	int len = strlen(szS);


	int nowCount;
	int nowLen = 1;

	std::set<std::string> sset;
	for (int i = 0; i < len; i++) {
		for (int j = i + 1; j <= tp_min(i + 5, len); j++) {
			char tmp = szS[j];
			szS[j] = '\0';
			
			std::string stmp = &szS[i];
			sset.insert(stmp);

			szS[j] = tmp;
		}
	}

	auto setIt = sset.begin();
	for (int i = 0; i < K - 1; i++) {
		setIt++;
	}
	
	printf("%s\n", setIt->c_str());
}


Measured memory_bytes: 1664
/*
 * atcoder/abc167/a.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

string S, T;
void solve() {
  cin >> S >> T;
  bool no = false;
  for (int i=0; i<S.size(); i++) {
    no |= S[i] != T[i];
  }
  if (no) cout << "No" << endl;
  else cout << "Yes" << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<s.size()/2;i++){
		if(s[i]!=s[s.size()-1-i]){
			ans++;
		}
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
S = list(input())
T = list(input())


def count_diff(s_bubun, t_all):
    cnt = 0
    for i in range(len(s_bubun)):
        if s_bubun[i] != t_all[i]:
            cnt += 1
    return cnt


i = 0
len_t = len(T)
ans = 10**10
while i+len_t <= len(S):
    s_bubun = S[i:i+len_t]
    kouho = count_diff(s_bubun, T)
    ans = min(kouho, ans)
    i += 1

print(ans) if ans != 10**10 else print(0)


Measured memory_bytes: 9136
import java.util.*;
import java.io.*;


public class Main{
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int N = sc.nextInt();
        int[] t = new int[N];
        int[] x = new int[N];
        int[] y = new int[N];
        for(int i=0;i<N;i++){
            t[i] = sc.nextInt();
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }
        boolean flag = true;
        int nowX = 0;
        int nowY = 0;
        for(int i=0; i<N;i++){
            int ins = Math.abs(x[i]-nowX)+Math.abs(y[i]-nowY);
            if(t[i]<ins || t[i]%2!=ins%2){
                flag = false;
            }
        }

        if(flag) out.println("Yes");
        else out.println("No");
        // out.println(result);

        out.flush();
    }
        
}



class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 24688
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <cstdlib>
using namespace std;
 
int main () {
	int a,b,c,big,small,i;
	cin >> a >> b;
	if(a>=b){ big=a; small=b;}
	else{ big=b; small=a;}
	while(big%small!=0){
		c=big%small;
		big=small;
		small=c;
	}
	cout << small << endl;
}

Measured memory_bytes: 1160
n = int(input())
ps = list(range(55556))
ps[1] = 0
primes = []
for i in range(2, 55556//2):
  if ps[i] != 0:
    primes.append(i)
    for j in range(55556)[::i]:
      ps[j] = 0
primes = [p for p in primes if p % 5 == 1]
print(' '.join( map(str, primes[:n]) ))


Measured memory_bytes: 5108
line = input().split()
l = list(map(int, line))
a = l[0]
b = l[1]
c = l[2]

if a == b and b == c:
    print (1)
elif ( a == b and b != c ) or (a != b and b == c) or (a == c and a != b):
    print (2)
else:
    print (3)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<climits>
#include<queue>
#include<vector>
#include<utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
typedef pair<ll,int> pi;
const ll INF=1e+16;
struct edge{//辺の情報
  int to;
  ll cost;
};
int V,E;//頂点の数、辺の数
vector<edge> g[100010];
ll d[100010];//d[u]は始点から頂点uへの最短距離
void dijkstra(int s){//始点sからのダイクストラ
  priority_queue<pi,vector<pi>,greater<pi> > q;//pair(コスト、頂点)としてコストの小さい順に並ぶ
  for(int i=0;i<V;i++) d[i]=INF;//初期化
  d[s]=0;
  q.push(pi(0,s));
  while(!q.empty()){
    pi p = q.top();q.pop();
    int w=p.second;//最新の確定した頂点
    if(d[w]<p.first) continue;//取り出した頂点のコストが最短コストより長かったら破棄
    for(int i=0;i<g[w].size();i++){//取り出した頂点と隣接した頂点を調べる
      int t=g[w][i].to;
      ll c=g[w][i].cost;
      if(d[t]>d[w]+c){//頂点tまでの暫定最短距離よりwまでの最短距離+w→tのコストが小さければ更新
	d[t]=d[w]+c;
	q.push(pi(d[t],t));
      }
     }
  }
}
int n,q,k;
int a[100010],b[100010];
ll c[100010];
int x[100010],y[100010];
int main(){
  cin>>n;
  rep(i,n-1){
    cin>>a[i]>>b[i]>>c[i];
    a[i]--;b[i]--;
  }
  cin>>q>>k;
  k--;
  rep(i,q){
    cin>>x[i]>>y[i];
    x[i]--;y[i]--;
  }
  V=n;
  rep(i,n-1){
    edge e;
    e.to=b[i];e.cost=c[i];
    g[a[i]].push_back(e);
    e.to=a[i];
    g[b[i]].push_back(e);
  }
  dijkstra(k);
  rep(i,q){
    prin(d[x[i]]+d[y[i]]);
  }



  

  

  

  return 0;
}


Measured memory_bytes: 13424
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define Cout(s) cout << s << endl;
using ll = long long;
using P = pair<int, int>;

const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;

int main()
{

    vector<int> a(5);
    int idx;
    int mini = 10;
    REP(i, 5)
    {
        int x;
        cin >> x;
        int tmp = x % 10;
        if (tmp != 0 && tmp < mini)
        {
            idx = i;
            mini = tmp;
        }
        a[i] = x;
    }
    int ans = 0;
    REP(i, 5)
    {
        if (i != idx)
        {
            if (a[i] % 10 != 0)
            {
                int x = (10 - a[i] % 10) + a[i];
                ans += x;
            }
            else
            {
                ans += a[i];
            }
        }
        else
        {
            ans += a[i];
        }
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  vector<vector<int>> A(N,vector<int>(M));
  for(int i = 0 ; i < M ; i++){
    cin >> B.at(i);
  }
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < M ; j++){
      cin >> A.at(i).at(j);
    }
  }
  int ans = 0;
  for(int i = 0 ; i < N ;i ++){
    int num = 0;
    for(int j = 0 ; j < M ; j ++){
      num += B[j] * A[i][j];
      //cout << "j = " << j << " num = " << num << endl;
    }
    if(num  + C> 0){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3492
// atcoder/apc001/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  lli x, y;
  while (cin >> x >> y) {
    if (x % y == 0) cout << -1 << endl;
    else cout << x * y / __gcd(x, y) - x << endl;
  }

  return 0;
}


Measured memory_bytes: 3648
N = int(input())
A = 0
B = 0
AB = 0
ans = 0
for _ in range(N):
    S = input()
    ans += S.count("AB")
    if S[0] == "B":
        if S[-1] == "A":
            AB += 1
        else:
            B += 1
    elif S[-1] == "A":
        A += 1

if AB:
    ans += AB-1
    if A:
        ans += 1
        A -= 1
    if B:
        ans += 1
        B -= 1

ans += min(A, B)
print(ans)

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

int main() {
  
  int N, L;
  int length = 0;

  cin >> N >> L;
  
  vector<string> s(N);

  for (int i = 0; i < N; i++) cin >> s.at(i);  
  
  sort(s.begin(), s.end());
  
  for (int i = 0; i < N; i++)   cout << s.at(i);
  
}

Measured memory_bytes: 256
N, Q = map(int, input().split())
graph = [[] for i in range(200010)]
ans = [0 for i in range(200010)]
import sys
#sys.setrecursionlimit(100000)
sys.setrecursionlimit(10**7)
#
readline = sys.stdin.readline


for _ in range(N - 1):
    #a, b = map(int, input().split())
    a, b = map(int, readline().split())
    a -= 1
    b -= 1

    graph[a].append(b)
    graph[b].append(a)

for _ in range(Q):
    #p, x = map(int, input().split())
    p, x = map(int, readline().split())
    p -= 1

    ans[p] += x

def dfs(node, frm=-1):
    for to in graph[node]:
        if to == frm:
            continue
        ans[to] += ans[node]
        dfs(to, node)
dfs(0)

print(*ans[:N])

Measured memory_bytes: 268384
// In the name of GOD
 
#include <bits/stdc++.h>
#define ll long long
#define pp pair <int, int>
using namespace std;
const ll N = 2e7, MOD =  998244353;

void solve() {
   string s;
   cin >> s;
   string ans = "";
   for (int i = 0; i < 3; ++i)
    ans += s[i];
    cout << ans;
}
int main()  {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int tt = 1;
    // cin >> tt;
    for (int tc = 1; tc <= tt; ++tc) {
        solve();
    }
}                                   

Measured memory_bytes: 3656
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
// using namespace __gnu_pbds;
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
 
 
#define F first
#define S second
#define ll long long
#define pb push_back
#define db double
#define ld long double
#define ppb pop_back
#define pii pair<int, int>
#define pll pair<long long, long long>
#define piii pair<int, pii>
#define all(x) (x).begin(),(x).end()
#define __ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define int long long
 
const int N = 1e5 + 1, inf = 2e9 + 7, mod = 1e9 + 7;
const ll INF = 2e18 + 7, MOD = 1e15 + 7;
 
int w[101], v[101], dp[N];
 
signed main() { __
    // freopen("a.in", "r", stdin);
    // freopen("a.out", "w", stdout);
    int n, W;
    cin>>n>>W;
    for(int i = 1; i <= n; i++) {
        cin>>w[i]>>v[i];
    }
    for(int i = 0; i <= 1e5; i++) dp[i] = inf;
    dp[0] = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1e5; j >= v[i]; j--) {
            dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
        }
    }
    int ans = -1;
    for(int i = 1; i <= 1e5; i++) {
        if(dp[i] <= W) ans = i;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
ll n,k,t,d;
std::vector<P> a;
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.se > b.se);
}
void solve(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>k;
  a.resize(n);
  rep(i,n) cin>>a[i].fi>>a[i].se;
  map<int,ll> m;
  sort(all(a),sortbysec);
  // reverse(all(a));
  // rep(i,n) cout<<a[i].fi<<" "<<a[i].se<<endl;
  ll ans = 0,sum = 0,r = 0;
  rep(i,n){
    // cout<<ans<<endl;
    if(i<k) {
      sum+=a[i].se;
      m[a[i].fi]++;
      if(i==k-1){
        ans = sum + m.size()*m.size();
        r = i;
      }
    } else {
      if(!m.count(a[i].fi)){
        m[a[i].fi]++;
        while(r>-1 and m[a[r].fi]==1) r--;
        if(r==-1) break;
        sum += a[i].se - a[r].se;
        m[a[r].fi]--;r--;
        ans = MAX(ans,sum+m.size()*m.size());
      }
    }
  }
  cout<<ans<<endl;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 4992
# 全探索
x, n = map(int, input().split())

if n == 0:
    print(x)
else:
    p = list(map(int, input().split()))

    min_list = []
    
    for i in range(-200, 200):
        if i not in p:
            ans = abs(i-x)
            min_list.append(ans)
    
    minimum = min(min_list)
    minimum_right = x + minimum
    minimum_left = x - minimum

    if minimum_right and minimum_left not in p:
        print(minimum_left)
    elif minimum_right not in p:
        print(minimum_right)
    else:
        print(minimum_left)

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

int main() {
	long double n,k;
	cin>>n>>k;
	long double ans=0;
	for(ll i=1;i<=n;i++){
		ll now=i;
		long double cnt=1/n;
		while(now<k){
			now*=2;
			cnt/=2.0;
		}
		ans+=cnt;
	}
	printf("%.10Lf",ans);
	// your code goes here
	return 0;
}

Measured memory_bytes: 3768
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v(10+1);
    v[0] = c;
    for(int i = 1; i < 10+1; i++){
        v[i] = a*v[i-1]-b;
    }
    for(int i = 1; i <= 10; i++){
        cout << v[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
static const int N = 100;

int main()
{
    int M[N][N];
    int n, u, k, v;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
            M[i][j] = 0;
    }

    for (int i = 0; i < n; i++)
    {
        cin >> u >> k;
        u--;
        for (int j = 0; j < k; j++)
        {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (j)
                cout << " ";
            cout << M[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind, COM//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path;
//***********//
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
int main() {
	cin >> N;
	vl A(N);
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	ll ans = A[0];
	for (i = 1; i < N; i++) {
		ans = gcd(ans, A[i]);
	}
	cout << ans;
}


Measured memory_bytes: 1024
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  string S;
  ll K;
  cin >> S >> K;
  smatch m;
  regex_match(S, m, regex("^(1*)([1-9]*)$"));
  cout << ((m.length(1) >= K) ? '1' : m.str(2).front()) << endl;
  return 0;
}


Measured memory_bytes: 3744
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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 ll  lINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  int n;
  cin >> n;
  vi t(n);
  rep(i,n) cin >> t[i];

  int m;
  cin >> m;

  vi p(m),x(m);
  rep(i,m) cin >> p[i] >> x[i];
  rep(i,m){
    int ans = 0;
    
    rep(j,n){
      if(p[i]-1==j) ans += x[i];
      else ans += t[j];
    }
    cout << ans << endl;
  }

  return 0;
} 

Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1<<29;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;


ll n,m;


void input(){
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n >> m;
}




int main(int argc, const char * argv[]) {
    
    input();
    
    if(n==1 && m==1) cout << 1 << endl;
    else if(n==1 || m==1) cout << max(n,m)-2 << endl;
    else cout << (n-2)*(m-2) << endl;
 
    return 0;
    
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define lower(a,x) lower_bound(all(a), x) - a.begin();
#define COUNT(a,x)  upper_bound(all(a), x) - lower_bound(all(a), x);
#define MCOUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x);
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end());
#define scan(x) scanf("%lld",&x);
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
typedef double D;
const ll inf = 5555555555555555555;
const ll mod = 1000000007;
const D pi = acos(-1);
const D eps = 1e-10;

ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok, flag;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111


int main(void) {
  ll k;
  cin >> n >> k;
  vll a(n);
  rep(i, n) {
	cin >> a[i];
	if (a[i] == 1) m = i + 1;
  }
  ll le, ri;
  ri = n - m;
  le = m - 1;
  k--;
  ans += (ri + k-1) / k;
  le -= (k - (ri%k)) % k;
  ans += (le + k -1) / k;

  ri = n - m;
  le = m - 1;
  tmp += (le + k-1) / k;
  ri -= (k - (le%k)) % k;
  tmp += (ri + k - 1) / k;

  //cout << ans << tmp << endl;
  ans = min(ans, tmp);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
var input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')
var [H1, M1, H2, M2, K] = input[0].split(' ').map(Number)
var diff = (H2 * 60 + M2) - (H1 * 60 + M1)
console.log(diff - K)


Measured memory_bytes: 29644
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        s: String,
    }

    let vc: Vec<char> = s.chars().collect();
    // if vc.len() == 1 {
    //     println!("YES");
    //     return;
    // } else if vc.len() == 2 {
    // }
    let mut c_cnt = vec![0; 3];
    for c in &vc {
        c_cnt[(*c as u8 - b'a') as usize] += 1;
    }
    c_cnt.sort();
    if (c_cnt[0] == c_cnt[1] && c_cnt[1] == c_cnt[2])
        || (c_cnt[0] == c_cnt[1] - 1 && c_cnt[1] == c_cnt[2])
        || (c_cnt[0] == c_cnt[1] && c_cnt[1] == c_cnt[2] - 1)
    {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 2648
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int n;
    cin >> n;

    if ( n <= 2 ) cout << n << endl;
    else {
        for ( int i = n; i >= 0; i-- ) {
            if ( (i & (i - 1)) == 0 ) {
                cout << i << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
fun main() {
    val l = readLine()!!.split(' ').map { it.toInt() }
    val map: MutableMap<Int, Int> = mutableMapOf()
    (1..l[1]).forEach{ map[it] = l[2] }

    val list: MutableList<Pair<Int, List<Int>>> = mutableListOf()
    for (i in 0 until l[0]) {
        var line = readLine()!!.split(' ').map { it.toInt() }.toMutableList()
        val c = line[0]
        line.removeAt(0)
        list.add(c to line)
    }

    var min = Int.MAX_VALUE
    var find = false
    fun search(tmpMap: MutableMap<Int, Int>, tmpMin: Int, x: Int) {
        if (x < l[0]-1) search(tmpMap.toMap().toMutableMap(), tmpMin, x+1)

        for (y in 0 until l[1]) {
            tmpMap[y+1] = tmpMap[y+1]!! - list[x].second[y]
        }

        if (tmpMap.all { it.value < 1 }) {
            min = Math.min(min, tmpMin+list[x].first)
            find = true
        } else {
            if (x < l[0]-1) search(tmpMap.toMap().toMutableMap(), tmpMin+list[x].first, x+1)
        }
    }

    search(map.toMap().toMutableMap(), 0, 0)

    println(if (find) min else -1)
}


Measured memory_bytes: 46000
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	p := make([]int, n)
	for i := 0; i < n; i++ {
		p[i] = nextInt()
	}

	cnt := 0
	for i := 1; i < n-1; i++ {
		if (p[i-1] <= p[i] && p[i] <= p[i+1]) || (p[i-1] > p[i] && p[i] > p[i+1]) {
			cnt++
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mset(x,y) memset(x,y,sizeof(x))
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#ifdef LOCAL
#define dmp(...) _dmp(#__VA_ARGS__, __VA_ARGS__)
#else
#define dmp(...) (__VA_ARGS__)
#endif
template<class T> using vt=vector<T>;
template<class T> using vvt=vt<vt<T>>;
template<class TA,class TB> void chmax(TA&a,TB b){if(a<b)a=b;}
template<class TA,class TB> void chmin(TA&a,TB b){if(b<a)a=b;}
template<class TA,class TB>
ostream& operator<<(ostream& os,const pair<TA,TB>& p){
	return os<<"{"<<p.fi<<","<<p.se<<"}";
}
template<class T> ostream& operator<<(ostream& os,const vt<T>& v){
	os<<"{";for(auto& e:v)os<<e<<",";return os<<"}";
}
template<class TH> void _dmp(const char *sdbg, TH h){cout<<sdbg<<"="<<h<<endl;}
template<class TH, class... TA> void _dmp(const char *sdbg, TH h, TA...a){
while(*sdbg!=',')cout<<*sdbg++;cout<<"="<<h<<","; _dmp(sdbg+1, a...);
}
template<class T> void make_unique(vt<T>& v) {
	sort(all(v));v.erase(unique(all(v)),v.end());
}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
int ri(){int x;cin>>x;return x;}
ll rll(){ll x;cin>>x;return x;}
vi rvi(int n){vi v;rep(i,n)v.pb(ri());return v;}
int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
void MAIN() {
	int k;
	cin>>k;
	cout<<a[k-1];
}
int main() {
	ios::sync_with_stdio(false);cin.tie(0);
	int T=1;
	//cin>>T;
	for(int tt=1;tt<=T;tt++) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 256
H,W,h,w=[int(i) for i in input().split()]

if H%h==0 and W%w==0:
        print("No")
elif W%w!=0:
        print("Yes")
        for y in range(H):
                for x in range(W):
                        if x!=0:
                                print(" ",end="")
                        if (x%w)!=(w-1):
                                print(100000,end="")
                        else:
                                print(-100000*(w-1)-1,end="")
                print()
else:
        print("Yes")
        for y in range(H):
                for x in range(W):
                        if x!=0:
                                print(" ",end="")
                        if (y%h)!=(h-1):
                                print(100000,end="")
                        else:
                                print(-100000*(h-1)-1,end="")
                print()

Measured memory_bytes: 5276
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <numeric>
#include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)   (x).begin(),(x).end()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define mp       make_pair
#define eb       emplace_back
typedef pair<LL, LL> P;
typedef pair<P, P> PP;

int main() {
	int x, y, z;
	cin >> x >> y >> z;
	int ans = 0;
	x -= z;
	ans += x / (y + z);
	cout << ans << endl;
}

Measured memory_bytes: 256
N, M = map(int,input().split())
C = [[] for k in range(N)]
for k in range(M):
    P, Y = map(int,input().split())
    C[P-1].append([Y,k])
D = []
for e in C:
    D.append(sorted(e))
A = [0]*M
for k in range(N):
    c = 1
    for e in D[k]:
        A[e[1]] = (k+1)*1000000 + c
        c += 1
for e in A:
    print(str(e).zfill(12))


Measured memory_bytes: 48552
// ABC099_C
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18（const int inf   = 1<<29;）

template<class T> inline bool chmin(T& a, T b) {
    // chmin: change minimum
    // a より b の方が小さかったら，a の値を b の値に置き換える．
    // 書き換えた場合，true を返す
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N;
    cin >> N;
    
    // calculation
    // prepare [6, 36, ...], [9, 81, ...]
    vector<ll> vec = {1};  // [1]
    for (ll i = 6; i <= N; i *= 6) vec.push_back(i);
    for (ll i = 9; i <= N; i *= 9) vec.push_back(i);
    sort(vec.begin(), vec.end());
    
    // init dp table
    vector<ll> dp(N+1, INF);
    REP(i, vec.size()) dp[vec[i]] = 1;
    dp[0] = 0;
    
    ll basis = 1;
    for (ll i = 1; i <= N; ++i) {
        // if(dp[i] == 1) {
        //     basis = i;  // 1, 6, 9, ...
        //     continue;
        // } else {
        //     // dp[i-1] までの引き出し回数は最小化されている
        //     chmin(dp[i], 1 + dp[i-basis]);  // 1 は basis の分
        // }
        REP(j, vec.size()) {
            if (i - vec[j] > 0) chmin(dp[i], dp[i - vec[j]] + 1);
        }
    }
    
    cout << dp[N] << "\n";
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(t) (t).begin(),(t).end()
typedef long long ll;

int main() {
	int Ans=0;
	int N; cin >> N;
	int D; cin >> D;
	REP(i,N){
		ll X; cin >> X;
		ll Y; cin >> Y;
		if (sqrt( X*X + Y*Y ) <= D) {
			Ans++;
		}
	}
	cout << Ans << '\n';
	return 0;
}


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

ll c[51][51];

void comb_table(int n){
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= i; j++){
            if(i == j || j == 0) c[i][j] = 1LL;
            else c[i][j] = c[i-1][j-1] + c[i-1][j];
        }
    }
    return;
}

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    ll v[n];
    map<ll, int> mp;
    rep(i, n){
        cin >> v[i];
        mp[v[i]]++;
    }
    sort(v, v + n);
    reverse(v, v + n);

    comb_table(n);

    double max_av = 0.0;
    int cnt = 0;
    rep(i, a){
        max_av += v[i];
        if(v[i] == v[a-1]) cnt++;
    }
    max_av /= a;

    ll pat = 0LL;
    if(cnt == a){
        for(int i = a; i <= min(b, mp[v[a-1]]); i++){
            pat += c[mp[v[a-1]]][i];
        }
    } else {
        pat += c[mp[v[a-1]]][cnt];
    }

    cout.precision(6);
    cout << fixed << max_av << endl;
    cout << pat << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int h, w;
	scanf("%d %d", &h, &w);
	char data[51][51];
	int flag = 1;
	for (int i = 1; i <= h; i++) {
		//for (int j = 1; j <= w; j++) {
			scanf("%s", &data[i][1]);
		//}
		//scanf("\n");
	}
	for (int i = 2; i < h; i++) {
		for (int j = 2; j < w; j++) {
			if (data[i][j] == '#') {
				if (!(data[i - 1][j] == '#' || data[i + 1][j] == '#' || data[i][j - 1] == '#' || data[i][j + 1] == '#'))flag = 0;
			}
		}
	}
	for (int i = 2; i < h; i++) {
		if (data[i][1] == '#') {
			if (!(data[i][2] == '#' || data[i - 1][1] == '#' || data[i + 1][1] == '#'))flag = 0;
		}
		if (data[i][w] == '#') {
			if (!(data[i][w - 1] == '#' || data[i - 1][w] == '#' || data[i + 1][w]=='#'))flag = 0;
		}

	}
	if (data[1][1] == '#') {
		if (!(data[2][1] == '#' || data[1][2] == '#'))flag = 0;
	}
	if (data[1][w] == '#') {
		if (!(data[2][w] == '#' || data[1][w-1] == '#'))flag = 0;
	}
	if (data[h][1] == '#') {
		if (!(data[h-1][1] == '#' || data[h][2] == '#'))flag = 0;
	}
	if (data[h][w] == '#') {
		if (!(data[h-1][2] == '#' || data[h][w-1] == '#'))flag = 0;
	}
	
	for (int j = 2; j < w; j++) {
		if (data[1][j] == '#') {
			if (!(data[1][j-1] == '#' || data[2][j] == '#' || data[1][j+1] == '#'))flag = 0;
		}
		if (data[h][j] == '#') {
			if (!(data[h][j - 1] == '#' || data[h-1][j] == '#' || data[h][j+1] == '#'))flag = 0;
		}
	}
	if (flag) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
n, k = map(int, input().split())
p = list(map(int, input().split()))

exp = list(map(lambda x: (x+1)/2, p))

sum = [0]
for i in range(n):
    sum.append(sum[i] + exp[i])

max = 0
for i in range(n-k+1):
    if sum[i+k] - sum[i] > max:
        max = sum[i+k] - sum[i]

print(max)

Measured memory_bytes: 25060
# include <algorithm>
# include <iostream>
# include <cmath>
# include <string>
# include <vector>

using namespace std;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	
    int n,d;
    cin >> n >> d;
    vector<vector<float> > A(n, vector<float>(d));
    bool ok = false;
 
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            cin >> A[i][j];
        }
    }
 
    float count = 0;
    float tmp = 0;
    //double unchi = 1;
    int ans=0;
 
 
    for(int i = 0; i < n-1; i++){
        for (int j = i+1; j < n; j++){
            for(int k = 0; k < d; k++){
                count+=(A[i][k]-A[j][k])*(A[i][k]-A[j][k]);
            }
        tmp=sqrt(count);
        if(fmod(tmp,1)==0){
            ans++;
        }
        count = 0;
        }
    }
 
    cout << ans <<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    ll h, w;
    cin >> h >> w;
    if(h==1 || w==1){
        cout << 1 << endl;
    }else if(h%2==1 && w%2==1){
        cout <<  h*w/2+1 << endl;
    }else{
        cout <<  h*w/2 << endl;
    }
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256