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

using namespace std;
typedef long long ll;
int a[200010],b[200010];
int main()
{
    int n;scanf("%d",&n);
    int x;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        a[x]++;
        b[i]=x;
    }
    ll sum=0;
    for(int i=1;i<=n;i++){
        if(a[i]>=2) sum+=1ll*(a[i]-1)*a[i]/2;
    }
    for(int i=1;i<=n;i++){
         ll k=a[b[i]];
         cout<<sum-k+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 3712
#include <stdio.h>
int n, x;
long long ans, t;
int a[200000];
long long c[200001];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", a + i);
		c[a[i]]++;
	}
	for (int i = 1; i <= n; i++) {
		ans += c[i] * (c[i] - 1) / 2;
	}
	for (int i = 0; i < n; i++) {
		t = ans;
		ans -= c[a[i]] * (c[a[i]] - 1) / 2;
		ans += (c[a[i]] - 1) * (c[a[i]] - 2) / 2;
		printf("%lld\n", ans);
		ans = t;
	}
}

Measured memory_bytes: 3840
#include <iostream>
#include <cmath>

namespace Geometry {
  using Float = long double;
  using Real = long long;
  constexpr Float eps = 1e-9;

  namespace Plane {
    struct Vec {
      Real x, y;
      constexpr Vec() : x(0), y(0) {}
      constexpr Vec(Real k) : x(k), y(k) {}
      constexpr Vec(Real x, Real y) : x(x), y(y) {}
      static constexpr Real dot(Vec v, Vec w) { return v.x*w.x + v.y*w.y; }
      static constexpr Real cross(Vec v, Vec w) { return v.x*w.y - v.y*w.x; }
      static constexpr Vec rot(Vec v, Vec w) { return Vec(v.x*w.x - v.y*w.y, v.x*w.y + v.y*w.x); }
      constexpr Real norm2() const { return x*x+y*y; }
      Float norm() const { return std::sqrt(x*x+y*y); }
      Float arg() const { return std::atan2(x, y); }
      constexpr Vec& operator+=(Vec const& v) { x += v.x; y += v.y; return *this; }
      constexpr Vec& operator-=(Vec const& v) { x -= v.x; y -= v.y; return *this; }
      constexpr Vec& operator*=(Real const& k) { x *= k; y *= k; return *this; }
      constexpr Vec& operator*=(Vec const& v) { x *= v.x; y *= v.y; return *this; }
      constexpr Vec operator-() const { return Vec(-x, -y); }
      friend constexpr Vec operator+(Vec const& v, Vec const& w) { return Vec(v) += w; }
      friend constexpr Vec operator-(Vec const& v, Vec const& w) { return Vec(v) -= w; }
      friend constexpr Vec operator*(Real const& k, Vec const& v) { return Vec(v) *= k; }
      friend constexpr Vec operator*(Vec const& v, Vec const& w) { return Vec(v) *= w; }
      constexpr int ort() const { // orthant
        // if(abs(x) < eps && abs(y) < eps) return 0;
        if(  x>0  && !(y<0)) return 1; //  x>0 && y>=0
        if(!(x>0) &&   y>0 ) return 2; // x<=0 &&  y>0
        if(  x<0  && !(y>0)) return 3; //  x<0 && y<=0
        if(!(x<0) &&   y<0 ) return 4; // x>=0 &&  y<0
        return 0;
      }
      friend constexpr bool operator<(Vec const& a, Vec const& b) {
        int ao = a.ort() , bo = b.ort();
        if(ao != bo) return ao < bo;
        //if(ao == 0) return false;
        return 0 < cross(a, b);
      }
      friend std::istream& operator>>(std::istream& is, Vec& v) noexcept { is >> v.x >> v.y; return is; }
      friend std::ostream& operator<<(std::ostream& os, Vec const& v) noexcept { os << '(' << v.x << ',' << v.y << ')'; return os; }
    };

  }
}
using Geometry::Plane::Vec;

#include <iomanip>
#include <algorithm>
#include <vector>

signed main() {
  using namespace std;

  // abc139_f
  int n; cin >> n;

  vector<Vec> v(n);
  for(int i=0; i<n; ++i) cin >> v[i];

  sort(v.begin(), v.end());
  // for(int i=0; i<n; ++i) cerr << v[i] << ' '; cerr << endl;

  long long ans = 0;
  Vec now{};
  for(int l=0,r=0; l<n; ++l) {
    while(r-l<n) {
      if((now+v[r%n]).norm2() < now.norm2()) break;
      now += v[r%n];
      ++r;
    }
    // cerr << l << ' ' << r << ' ' << now << endl;
    if(ans < now.norm2()) ans = now.norm2();
    now -= v[l];
  }

  cout << fixed << setprecision(15) << sqrt(ans) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int a;

signed main() {
	cin >> a;
	if (a == 25)cout << "Christmas" << endl;
	if (a == 24)cout << "Christmas Eve" << endl;
	if (a == 23)cout << "Christmas Eve Eve" << endl;
	if (a == 22)cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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



int main() {
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a.at(i);
    }
    sort(a.begin(),a.end());
    vector<int>b(a.at(n-1)+10, 0);
    // cout<<"AAA"<<endl;
    for(int i=0;i<n;i++){
        b.at(a.at(i))++;
    }
    // cout<<"BBB"<<endl;
    int ans=0;
    // cout<<"AAA"<<endl;
    for(int i=1;i<a.at(n-1)+5;i++){
        ans=max(ans, b.at(i-1)+b.at(i)+b.at(i+1));
    }
    cout<<ans<<endl;








    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int H,W,K;
string s[6];
main()
{
	cin>>H>>W>>K;
	for(int i=0;i<H;i++)cin>>s[i];
	int ans=0;
	for(int i=0;i<1<<H;i++)for(int j=0;j<1<<W;j++)
	{
		int cnt=0;
		for(int I=0;I<H;I++)for(int J=0;J<W;J++)if(!(i>>I&1)&&!(j>>J&1))cnt+=s[I][J]=='#';
		ans+=cnt==K;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3592
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        Set<Integer> mochiSet = new HashSet<>();
        for(int i = 0;i < n; i++) {
            mochiSet.add(sc.nextInt());
        }

        System.out.println(mochiSet.size());
    }
}

Measured memory_bytes: 21844
import java.util.*

val sc = Scanner(System.`in`)
val N = sc.nextInt()

fun main(args: Array<String>) {
    (if (N % s(N) == 0) "Yes" else "No").let(::println)
}

fun s(n: Int): Int {
    return n.toString().map { (it + "").toInt() }.sum()
}


Measured memory_bytes: 29588
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int x,y;
		x = scan.nextInt();
		y = scan.nextInt();
		
		boolean isExist = false;
		
		//	鶴がi匹のとき、亀はx-i匹
		for(int i=0;i<=x;i++) {
			if(((i*2)+((x-i)*4) == y)){
				isExist = true;
			}
		}
		
		if(isExist) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


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

int main(){
  int N,L;
  cin >> N >> L;
  vector <string> a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  for(int i=0;i<N;i++){
    cout << a.at(i);
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int s = 0;
    char a[4];
    for (int i = 0; i <= 3; i++) {
        cin >> a[i];
        if(a[i] == '+')
            s++;
        else
            s--;
    }
    cout << s;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fname "A"
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define bug(x) cerr << (#x) << " = " << (x) << '\n'
#define REP0(i, n) for(int i = 0, _n = (n); i < _n; ++i)
#define REP1(i, n) for(int i = 1, _n = (n); i <= _n; ++i)
#define REPB0(i, n) for(int i = (n) - 1; i >= 0; --i)
#define REPB1(i, n) for(int i = (n); i > 0; --i)
#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
#define FORB(i, a, b) for(int i = (a), _b = (b); i >= _b; --i)
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define X first
#define Y second

using namespace std;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<float, float> ff;
typedef pair<double, double> dd;

int main()
{
	if (fopen(fname".INP", "r")) {
		freopen(fname".INP", "r", stdin);
		freopen(fname".OUT", "w", stdout);
	}
	ios_base::sync_with_stdio(false); cin.tie(0);
	vector<string> s(4);
	cin >> s[1] >> s[2] >> s[3];
	reverse(s[1].begin(), s[1].end());
	reverse(s[2].begin(), s[2].end());
	reverse(s[3].begin(), s[3].end());
	int t = 1;
	while(true) {
		if(t == 1 && s[1].empty()) {
			cout << 'A';
			break;
		}
		else if(t == 2 && s[2].empty()) {
			cout << 'B';
			break;
		}
		else if(t == 3 && s[3].empty()) {
			cout << 'C';
			break;
		}
		if (t == 1) {
			if (s[1].back() == 'b') t = 2;
			else if (s[1].back() == 'c') t = 3;
			s[1].popb();
		}
		else if (t == 2) {
			if (s[2].back() == 'a') t = 1;
			else if (s[2].back() == 'c') t = 3;
			s[2].popb();
		}
		else {
			if (s[3].back() == 'a') t = 1;
			else if (s[3].back() == 'b') t = 2;
			s[3].popb();
		}
	}
	return 0;
}

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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long

int main()
{
	
	int n; cin>>n;
	pair<pair<string,int>,int> anko[n];
	rep(i,n){
		string s; int p;
		cin>>s>>p;
		anko[i]=make_pair(make_pair(s,-p),i);
	}
	sort(anko,anko+n);
	rep(i,n) cout<<anko[i].second+1<<endl;
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	char c; cin>>c;
	if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u') cout<<"vowel"<<endl;
	else cout<<"consonant"<<endl;

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]
    n, p = [int(x) for x in input().split()]
    i = 2
    pc = p
    f = defaultdict(int)
    while i * i <= pc:
        while p % i == 0:
            f[i] += 1
            p //= i
        i += 1
    if p != 1:
        f[p] += 1
    ans = 1
    for d in f:
        x = f[d] // n
        if x:
            ans *= pow(d, x)
    print(ans)

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""


Measured memory_bytes: 9932
n, k = map(int, input().split())
w = [int(input()) for i in range(n)]

def f(P):
    i = 0
    for j in range(k):
        s = 0
        while s + w[i] <= P:
            s += w[i]
            i += 1
            if i == n: return n
    return i

left = 0
right = 100000 * 10000

while right - left > 1:
    mid = (left + right) // 2
    v = f(mid)
    if v>=n:right=mid
    else: left = mid
print (right)

Measured memory_bytes: 11636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	int N;
	int C;
	int D[][];
	int c[][];
	int g[][];
	int cnt[];
	boolean used[];
	long ans = 100100100100100L;
	public void run() {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		C = sc.nextInt();
		D = new int[C+1][C+1];
		for(int i=1; i<=C; i++) {
			for(int j=1; j<=C; j++) {
				D[i][j]=sc.nextInt();
			}
		}
		c = new int[N][N];
		for(int i=0; i<N; i++) {
			for(int j=0; j<N; j++) {
				c[i][j]=sc.nextInt();
			}
		}

		g = new int[3][C+1];
		cnt = new int[3];
		for(int i=0; i<N; i++) {
			for(int j=0; j<N; j++) {
				int k = (i+j)%3;
				int l = c[i][j];
				g[k][l]++;
				cnt[k]++;
			}
		}
		used = new boolean[C+1];
		int ch[] = new int[3];
		nCk(ch, 0);
		System.out.println(ans);
		sc.close();
	}


	private void nCk(int ch[], int k) {
		if(k==3) {
			long tmp=0;
			for(int i=0; i<3; i++) {
				for(int j=1;j<=C; j++) {
					if(g[i][j]==0) continue;
					tmp += D[j][ch[i]] * g[i][j];
				}
			}
			ans = Math.min(tmp, ans);
			return;
		}
		for(int i=1; i<=C; i++) {
			if(!used[i]) {
				used[i]=true;
				ch[k]=i;
				nCk(ch, k+1);
				used[i]=false;
			}
		}
	}
}


Measured memory_bytes: 81368
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N,M;cin >> N >> M;
    vector<int> p(M);
    vector<string> S(M);
    rep(i,M){
        cin >> p[i] >> S[i];
        p[i]--;
    }
    vector<int> ct(N,0);
    vector<bool> ok(N,false);
    int ctn = 0;
    rep(i,M){
        if(S[i] == "WA"){
            if(!ok[p[i]])ct[p[i]]++;
        }
        else{
            if(!ok[p[i]])ctn++;
            ok[p[i]] = true;
        }
    }
    int ans = 0;


    rep(i,N)if(ok[i])ans += ct[i];
    cout << ctn << " " << ans << endl;
}


Measured memory_bytes: 6528
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  while(1){
    int a,b,c,d[10010],n,i,j,temp;
    cin >> a >> b >> c;
    temp=c*c+b*b;
    if(a == 0 && b== 0 && c == 0){
      break;
    }
    cin >> n;
    for(i=0;i<n;i++){
      cin >> d[i];
      if(sqrt(temp) < d[i]*2){
	cout << "OK" << endl;
      }
      else if(c >= d[i]*2 || b >= d[i]*2){
	cout << "NA" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
}

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

#define ll long long int
ll mod=1000000007;
string k;
ll d;

ll dp[10005][105][3];

ll recur(ll ind,ll rem,ll check){
	if(ind==k.size() && rem==0){return 1;}
	if(ind==k.size())return 0;
	if(dp[ind][rem][check]!=-1)return dp[ind][rem][check];
	
	ll ans=0;
	if(check){
	for(ll i=0;i<=9;i++){
		ans=(ans+recur(ind+1,(rem+i)%d,1))%mod;
	}
	}
	else{
		for(ll i=0;i<=k[ind]-'0';i++){
			if(i<k[ind]-'0'){
		ans=(ans+recur(ind+1,(rem+i)%d,1))%mod;}
		else{
		ans=(ans+recur(ind+1,(rem+i)%d,0))%mod;}	
		}
		
	}
//	cout<<ind<<' '<<rem<<' '<<check<<' '<<ans<<'\n';

	dp[ind][rem][check]=ans;
	return ans;
}

int main(){
	cin>>k>>d;
	memset(dp,-1,sizeof(dp));
	ll ans=recur(0,0,0)-1;
	if(ans<0)ans+=mod;
	cout<<ans;
}

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

#define Fi first
#define Se second
#define pb push_back
#define mp make_pair
#define rep(x, a, b) for(int x = (a); x <= (b); ++ x)
#define per(x, a, b) for(int x = (a); x >= (b); -- x)
#define rop(x, a, b) for(int x = (a); x < (b); ++ x)
#define por(x, a, b) for(int x = (a); x > (b); -- x) 

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int unt;
typedef double db;
typedef pair <int, int> pii;
typedef vector <int> vi;

const db eps  = 1e-8;
const db _PI  = 3.1415926535897932384;
const db _E   = 2.7182818284590452354;
const int inf = 0x3f3f3f3f;
const LL INF  = 0x3f3f3f3f3f3f3f3fll;

struct Point {
	db x, y;
	Point(db _x = 0, db _y = 0) { x = _x, y = _y; }
	void print() { printf("%.10f %.10f", x, y); }
};

typedef Point Vector;

Vector operator + (const Vector &a, const Vector &b) {
	return Vector(a.x + b.x, a.y + b.y);
}
Vector operator - (const Vector &a, const Vector &b) {
	return Vector(a.x - b.x, a.y - b.y);
}
Vector operator * (const Vector &a, const db &b) {
	return Vector(a.x * b, a.y * b);
}
Vector operator / (const Vector &a, const db &b) {
	return Vector(a.x / b, a.y / b);
}
db operator * (const Vector &a, const Vector &b) {
	return a.x * b.x + a.y * b.y;
}
db operator ^ (const Vector &a, const Vector &b) {
	return a.x * b.y - a.y * b.x;
}
db dis(const Point &a, const Point &b) {
	return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
db dis2(const Point &a, const Point &b) {
	return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
Point Projection(const Point &p1, const Point &p2, const Point &p) {
	db len = (p2 - p1) * (p - p1);
	return p1 + (p2 - p1) * (len / dis2(p1, p2));
}

int main() {
	Point p1, p2;
	scanf("%lf%lf%lf%lf", &p1.x, &p1.y, &p2.x, &p2.y);
	int q; scanf("%d", &q);
	rep(i, 1, q) {
		Point p;
		scanf("%lf%lf", &p.x, &p.y);
		Projection(p1, p2, p).print();
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 3244
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

int main(void){
    long double n,k;
    cin >> n >> k;
    vector<long double> pars;
    long double tag,box,res=0.0;
    for(long double i=1.0;i<=n;i+=1.0){
        if(i >= k){
            pars.push_back((n-k+1.0)/n);
            break;
        }
        tag = ceil(log2(k/i));
        box = pow(0.5,tag);
        pars.push_back(box/n);
    }
    for(int j=0;j<pars.size();j++){
        res += pars[j];
    }
    printf("%.15Lf\n",res);
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

//cout << fixed << setprecision(10);

int main() {
    ll n;
    cin >> n;
    vector<ll> p(n);
    for(int i=0;i<n;i++) cin >> p[i];
    int ans=0;
    for(int i=0;i<n-2;i++){
        if(max(p[i],max(p[i+1],p[i+2]))!=p[i+1] && min(p[i],min(p[i+1],p[i+2]))!=p[i+1]){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define int long long
#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

static const int MOD = 1000000007;

bool isprime[1003];
void eratos(int n) {
	for (int i = 0;i <= n;i++) isprime[i] = true;

	isprime[0] = isprime[1] = false;

	for (int i = 2;i*i <= n;i++) {
		if (isprime[i]) {
			int j = i + i;
			while (j <= n) {
				isprime[j] = false;
				j += i;
			}
		}
	}
}

signed main() {
	int N;
	cin >> N;
	
	eratos(N);

	/*
	REP(i, N + 1) {
		if (isprime[i]) cout << i << " ";
	}
	cout << endl;
	*/

	int nprime;
	int ans = 1;
	for (int i = 2;i <= N;i++) {
		if (isprime[i] == false) continue;

		nprime = 0;
		int j = i;
		while (j <= N) {
			nprime += (N / j);
			j *= i;
		}

		ans = (ans * (nprime + 1)) % MOD;
	}

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

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<cassert>
#include<complex>//real().imag().
#include<cctype>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<deque>
#include<string>
#include<utility>
#include<iterator>
#define pii pair<int,int>
#define make_pair mp
using namespace std;
typedef long long ll;
int a[100005];
int main()
{
    // freopen("D:\\in.txt","r",stdin);
    // freopen("D:\\out.txt","w",stdout);
    //ios::sync_with_stdio(false);
    //system("pause");
    string s;
    cin>>s;
    int sum=0;
    for(int i=1;i<s.size()-1;i++)
    {
        if(s[i-1]!=s[i+1])sum++;
    }
    if(sum==0)
    {
        cout<<"Second"<<endl;
    }else
    if(s[0]!=s[s.size()-1])
    {
        if(s.size()%2==1)
        {
            cout<<"First"<<endl;
        }else
            cout<<"Second"<<endl;
    }else
    {
        if((s.size()-1)%2==1)
        {
            cout<<"First"<<endl;
        }else
            cout<<"Second"<<endl;
    }
    return 0;
}



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

using namespace std;

#define MAX 181
#define MAX_N 1100000
#define INF 1e9
int arr[MAX];
int dp1[MAX_N], dp2[MAX_N];

void make(){
  vector<int> odd;
  for(int i = 1 ; i < MAX ; i++){
    arr[i] = i*(i+1)*(i+2)/6;
    if(arr[i] % 2) odd.push_back(arr[i]);
  }

  for(int i = 0 ; i < MAX_N ; i++){
    dp1[i] = dp2[i] = INF;
  }
  dp1[0] = dp2[0] = 0;
  for(int i = 0 ; i < MAX ; i++){
    for(int j = 0 ; j < MAX_N ; j++){
      if(j + arr[i] >= MAX_N) continue;
      dp1[j+arr[i]] = min(dp1[j+arr[i]], dp1[j]+1);
    }
  }

  for(int i = 0 ; i < odd.size() ; i++){
    for(int j = 0 ; j < MAX_N ; j++){
      if(j + odd[i] >= MAX_N) continue;
      dp2[j+odd[i]] = min(dp2[j+odd[i]], dp2[j]+1);
    }
  }
}

int main(){
  int n;

  make();
  while(cin >> n ,n){
    cout << dp1[n] << " " << dp2[n] << endl;
  }

  return 0;
}

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

 int main(){
  char n, N[10000];
  
  for ( int i = 0; i < 4; i++ ) cin >> N[i];
    

 if ((N[0] == N[1]) && (N[2] == N[3]) && (N[1] == N[2])) {
  cout << "Yes" << endl;
  }

  else if((N[0] == N[1]) && (N[1] == N[2])) {
  cout << "Yes" << endl;
  }

  else if((N[1] == N[2]) && (N[2] == N[3])) {
  cout << "Yes" << endl;
  }

  else cout << "No" << endl;

 return 0;
}
	

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

#define INF 1e9+5
int main(){
    int n;
    int k;
    int h;
    cin>>n>>k;
    int res=0;
    for(int i=0;i<n;++i){
        cin>>h;
        if(h>=k) res++;
    }
    cout<<res<<"\n";
    return 0;
}


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

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, mm;
	cin >> nn >> mm;
	if(nn == mm)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <functional>
#include <algorithm>
using namespace std;

int p[10];

int main(){
	for(int i = 0; i < 2; i++){
		int ans = 0;
		for(int j = 0; j < 10; j++) scanf("%d", &p[j]);
		sort(p,p+10,greater<int>());
		for(int j = 0; j < 3; j++) ans += p[j];
		if(i == 0) printf("%d", ans);
		else printf(" %d\n", ans);
	}
}

Measured memory_bytes: 1040
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>

#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define INF 1000000000
#define SIZE 100000

int main()
{
	int n;
	int a[100000];

	scanf("%d", &n);

	int i;

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

	for (i = 0; i < n; i++)
	{
		printf("%d", a[n - i - 1]);
		if (i != n - 1)
			printf(" ");
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2056
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define int long long int
using namespace std;
void erase(map<int,multiset<int>>& data,int q,int w){
      map<int,multiset<int>>::iterator itr=data.find(q);
      multiset<int>::iterator it=itr->second.find(w);
      itr->second.erase(it);
      if(itr->second.size()==0)data.erase(itr);
}
int32_t main(){
      ios_base::sync_with_stdio(false);
     cin.tie(NULL);
      int n,ln=INF,rx=-INF;
      cin>>n;
      map<int,multiset<int>> L,R;
      vector<ii> arr;
      for(int i=0;i<n;i++){
            int l,r;
            cin>>l>>r;
            if(r-l+1>rx-ln+1){
                  rx=r;
                  ln=l;
            }
            L[l].insert(r);
            R[r].insert(l);
            arr.pb({l,r});
      }
      map<int,multiset<int>>l=L,r=R;
      erase(l,ln,rx);
      erase(r,rx,ln);
      int ans=max((int)0,rx-ln+1)+max((int)0,r.begin()->first-l.rbegin()->first+1);
      l=L,r=R;
      map<int,multiset<int>>::iterator itr;
      multiset<int>::iterator it;
      int rn=r.begin()->first;
      int lim=*r.begin()->second.rbegin();
      erase(r,rn,lim);
      erase(l,lim,rn);
      ans=max(ans,max((int)0,rn-lim+1)+max((int)0,r.begin()->first-l.rbegin()->first+1));
      while((l.size()>0)&&l.begin()->first<=lim){
            itr=l.begin();
            for(it=itr->second.begin();it!=itr->second.end();it++){
                  erase(r,*it,itr->first);
            }
            l.erase(itr);
      }
      if(r.size()>0)
      ans=max(ans,max((int)0,rn-lim+1)+max((int)0,r.begin()->first-l.rbegin()->first+1));
      while(r.size()>0){
            itr=r.begin();
            for(it=itr->second.begin();it!=itr->second.end();it++){
                  lim=max(lim,*it);
                  erase(l,*it,itr->first);
            }
            r.erase(itr);
            while((l.size()>0)&&l.begin()->first<=lim){
                  itr=l.begin();
                  for(it=itr->second.begin();it!=itr->second.end();it++){
                        erase(r,*it,itr->first);
                  }
                  l.erase(itr);
            }
            if(r.size()>0)
            ans=max(ans,max((int)0,rn-lim+1)+max((int)0,r.begin()->first-l.rbegin()->first+1));
      }
      cout<<ans;
}


Measured memory_bytes: 58096
#include<iostream>
 
using namespace std;
 
int main(){
    int n,k;
    int ans=1;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        if(ans<=k) ans*=2;
        else ans+=k;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
    int H, W;
    cin >> H >> W;
    bool s[H][W];
    string S;
    for (int i = 0; i < H; i++)
    {
        cin >> S;
        for (int j = 0; j < W; j++)
        {
            if (S[j] == '#')
            {
                s[i][j] = true;
            }
            else
            {
                s[i][j] = false;
            }
        }
    }

    int di[4] = {1, 0, -1, 0};
    int dj[4] = {0, 1, 0, -1};
    string ans = "Yes";
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (s[i][j])
            {
                bool flag = false;
                for (int k = 0; k < 4; k++)
                {
                    int new_i = i + di[k];
                    int new_j = j + dj[k];
                    if ((0 <= new_i && new_i < H) && (0 <= new_j && new_j < W))
                    {
                        if (s[new_i][new_j])
                        {
                            flag = true;
                        }
                    }
                }
                if (!flag)
                {
                    ans = "No";
                }
            }
        }
    }
    cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

string s;
int n, k;
int a, b, c;
int ans;
signed main() {
    cin >> n;
    cout << (n*n*n) << endl;
}


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

int main(){
    string S,T;
    cin >> S >> T;
    map<char,vector<ll>> mp;
    int N = S.size();
    int M = T.size();
    rep(i,N){
        mp[S[i]].push_back(i);
    }
    rep(i,M){
        if(mp[T[i]].empty()){
            cout << -1 << endl;
            return 0;
        }
    }
    ll ans = 0;
    ll pos = 0;
    rep(i,M){
        char c = T[i];
        auto itr = lower_bound(mp[c].begin(),mp[c].end(),pos);
        if(itr == mp[c].end()){
            // Sの最後まで見てもCが見つからなかった場合は次のSへ
            ans += S.size() - pos;
            pos = 0; // 一度リセット
            ans += mp[c][0] + 1; // Cが出てくる最初の位置まで進む
            pos = mp[c][0] + 1;
        }else{
            ans += *itr - pos + 1;
            pos = *itr + 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4612
import math
N=int(input())
h_max=math.floor(3*N/4)
d=10**(-5)
for h in range(1,min(h_max+1,3501)):
     if 4/N - 1/h == 0:
          continue
     n_max=math.floor(2/(4/N - 1/h))
     for n in range(h,min(n_max+1,3501)):
          if 4/N-1/h-1/n == 0:
               continue
          w=1/(4/N-1/h-1/n)
          if w-d<round(w) and round(w)<w+d and round(w)>=n:
               print(h,n,round(w))
               break
     else:
          continue
     break

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <cmath>
using namespace std;
using ll = long long;

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

    int N, sum = 0;
    cin >> N;

    vector<int> A(N);

    for (int i = 0; i < N; i++) { 
        cin >> A[i];
        sum += A[i]-1;
    }

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = Console.ReadLine()
            .Split(' ')
            .Select(int.Parse)
            .ToArray();

        Dictionary<int, int> dic = new Dictionary<int, int>();
        foreach (var num in a)
        {
            if(dic.ContainsKey(num))
            {
                dic[num]++;
            } else
            {
                dic.Add(num, 1);
            }
        }

        int max = int.MinValue;
        foreach(var entry in dic)
        {
            int lowCunt = dic.ContainsKey(entry.Key - 1) ? dic[entry.Key - 1] : 0;
            int highCount = dic.ContainsKey(entry.Key + 1) ? dic[entry.Key + 1] : 0;
            int sum = lowCunt + entry.Value + highCount;
            max = Math.Max(max, sum);
        }

        Console.WriteLine(max);
    }
}


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

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  string s;
  cin >> s;
  map<char, int> mp;
  rep(i, s.size()) { ++mp[s[i]]; }

  if (mp.size() != 2) {
    puts("No");
    return 0;
  }

  for (auto p : mp) {
    if (p.second != 2) {
      puts("No");
      return 0;
    }
  }

  puts("Yes");
  return 0;
}


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

using namespace std;

template<typename T>
long long modpow(const T n,const T p,const T mod);
template<typename T>
long long modinv(const T n,const T mod);
template<typename T>
bool chmax(T &a,const T &b);
template<typename T>
bool chmin(T &a,const T &b);

long long inf=1000000007;
long long n;
vector<long long> v;
vector<vector<long long>> dp;

long long solve(long long l,long long r){
	if(r-l<=1) return 0;
	if(r-l==2){
		if(abs(v.at(l)-v.at(l+1))<=1) return 2;
		else return 0;
	}

	long long &ret=dp.at(l).at(r);
	if(ret!=-1) return ret;

	if(abs(v.at(l)-v.at(r-1))<=1 && solve(l+1,r-1)==r-l-2) chmax(ret,r-l);
	else{
		for(long long i=l+1;i<=r-1;i++){
			chmax(ret,solve(l,i)+solve(i,r));
		}
	}

	return ret;
}

int main(){
	cin>>n;
	while(n!=0){
		v.resize(n);
		for(long long i=0;i<n;i++) cin>>v.at(i);
		dp.assign(n+1,vector<long long>(n+1,-1));

		cout<<solve(0,n)<<endl;

		cin>>n;
	}

	return 0;
}

template<typename T>
long long modpow(const T n,const T p,const T mod){
	if(p==0) return 1;
	if(p%2==0){
		long long a=modpow(n,p/2,mod);
		return a*a%mod;
	}
	if(p%2==1) return (modpow(n,p-1,mod)*n)%mod;
	cerr<<"ERROR"<<endl;
	return 1;
}

template<typename T>
long long modinv(const T n,const T mod){
	return modpow(n,mod-2,mod);
}

template<typename T>
bool chmax(T &a,const T &b){
	if(a<b){
		a=b;
		return 1;
	}
	return 0;
}

template<typename T>
bool chmin(T &a,const T &b){
	if(a>b){
		a=b;
		return 1;
	}
	return 0;
}



Measured memory_bytes: 3736
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> P;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
const int MAXN = 100000;
const int MAXE = 100000;
const int MAXV = 10000;
const int inf = 1e9;
const ll INF = 2e18;
const ll MOD = 1e9 + 7;

struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n){
        for(int i=0;i<n;++i) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[ry]>rank[rx]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};

vector<ll> fac,inv,finv;

void initcom(){
    fac=inv=finv=vector<ll>(1e6);
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[0]=finv[1]=1;
    for(ll i=2;i<1e6;++i){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

ll com(int n,int k){
    if(n<0||k<0) return 0;
    if(n<k) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll x,ll y){
    if(y==0) return x;
    return gcd(y,x%y);
}
ll mopow(ll a,ll x,ll mod){
    ll res=1;
    while(x>0){
        if(x&1) res=res*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return res;
}
int main(){
    int h,w;cin>>h>>w;
    vector<int> cnt(26,0);
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            char a;cin>>a;
            cnt[a-'a']++;
        }
    }
    bool flag=true;
    if(h%2==0&&w%2==0){
        for(int i=0;i<26;++i)if(cnt[i]%4!=0) flag=false;
        cout<<(flag?"Yes":"No")<<endl;
        return 0;
    }
    if(h%2==0||w%2==0){
        int lmt=(h%2==0?h/2:w/2);
        int c=0;
        for(int i=0;i<26;++i){
            if(cnt[i]%4==0) continue;
            if(cnt[i]%2==1) flag=false;
            else c++;
        }
        cout<<(flag&&c<=lmt?"Yes":"No")<<endl;
        return 0;
    }
    int lm2=h/2+w/2;
    int c1=0,c2=0;
    for(int i=0;i<26;++i){
        if(cnt[i]%4==0) continue;
        if(cnt[i]%4==1) c1++;
        else if(cnt[i]%4==2) c2++;
        else{
            c1++;c2++;
        }
    }
    cout<<(c1==1&&c2<=lm2?"Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 3560
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy
path1 = 'U' * dy + 'R' * dx
path2 = 'D' * dy + 'L' * dx
path3 = 'L' + 'U' * (dy+1) + 'R' * (dx+1) + 'D'
path4 = 'R' + 'D' * (dy+1) + 'L' * (dx+1) + 'U'
print(path1 + path2 + path3 + path4)

Measured memory_bytes: 3060
#include<iostream> 
#include<vector>
#include<algorithm>
#include<queue>
#include<stdio.h>
#include<vector>
using namespace std;
int main(){
  int n,m;
  priority_queue<long long> que;
  cin >> n >> m;
  int a;
  for(int i=0;i<n;i++){
    cin >> a;
    que.push(a);
  }
  for(int i=0;i<m;i++){
    a=que.top();
    que.pop();
    que.push(a/2);
  }
  long long ans=0;
  for(int i=0;i<n;i++){
    ans+=que.top();
    que.pop();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1400
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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 INF=1e18;

int main(){
    ll n;
    cin >> n;
    vector<ll> alpha(26,INF),buf(26);
    rep(i,n){
        string s;
        cin >> s;
        ll m=s.length();
        rep(j,m){
            ll num=s[j]-'a';
            buf[num]++;
        }
        rep(j,26){
            alpha[j]=min(alpha[j],buf[j]);
            buf[j]=0;
        }
    }
    rep(i,26){
        char c='a'+i;
        rep(j,alpha[i]){
            cout << c;
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3520
#include<stdio.h>
int main(void)
{
    int a,b;
    scanf("%d %d",&a,&b);
    if (a<b)
    printf("a < b\n");
    else
    if (a>b)
    printf("a > b\n");
    else
    if (a==b)
    printf("a == b\n");
    return 0;
    }

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > using vec = std::vector< T >;
template < class T > void print(T &x) { cout << x << "\n"; }
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  if (N%2==0){
    cout<<N<<"\n";
  }else{
    cout <<N*2<<"\n";
  }
  return 0;
}

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

int main(){
    int m,n;
    cin >> n >> m;
    vector<int> load(n,0);

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

    for(int i=0;i<n;i++){
        cout << load[i] << endl;
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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 INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int n;
   cin >> n;
   vector<int> a(n);
   rep(i, 0, n) cin >> a[i];
   int mn = 1e9 + 1;
   int mx = 0;
   rep(i, 0, n) {
      chmin(mn, a[i]);
      chmax(mx, a[i]);
   }
   int ans = mx - mn;
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
int main(void){
    int H,W,i,j;
    
    for(;;){
        scanf("%d %d",&H,&W);
        if(H+W==0){
            break;
        }
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                if((i+j)%2==0){
                    printf("#");
                }else if((i+j)%2==1){
                    printf(".");
                }
                if(j==W-1){
                    printf("\n");
                }
            }
        }
        printf("\n");
    }
    
    return 0;
}

Measured memory_bytes: 572
//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
//take care of precedence rule of operators 
//do not forget to change the sizes of arrays and value of contants and other things after debugging  
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)
 
#define SZ(x)  (ll)(x.size())
 
//comment the below if not required
 
/*
 
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second
*/
 
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

//cout<<"Case #"<<c<<": "<<ans<<"\n" ;

int main()
{

    int i,j,ans=INT_MAX,k,tot;

    string s1,s2;

    cin>>s1>>s2;

    int n1 = SZ(s1),n2 = SZ(s2);

    rep(i,0,n1)
    {
        tot=0;

        for(k=i,j=0;k<n1 && j<n2;++k,++j)
        {
            if(s1[k]!=s2[j])
                ++tot;
        }

        if(j==n2)
            ans = min(ans,tot);

    }

    cout<<ans;

    return 0;

}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define CONTAINS(a, x) (a.find(x) != a.end())
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define nl cout << endl
#define F first
#define S second
 
#define what_is(x) cout << #x << " = " << x << endl
#define boost ios::sync_with_stdio(false);cin.tie(NULL)
#define CASET int ___T, case_n = 1; cin >> ___T; while (___T-- > 0) 
 
 
#define rep(it, st, en) for(ll it = st; it < en; it++)
#define rep1(it, st, en) for(ll it = st; it <= en; it++)
#define per(it, st, en) for(ll it = en - 1; it >= st; it--)
 
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll,ll> pll;
 
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<ii> vii;
typedef vector<vi> vvi;
 
ll INF = 1E9;
ll M = 1E9 + 7;
 
inline ll max_(ll a, ll b) { return (a>b)?a:b; }
inline ll min_(ll a, ll b) { return (a<b)?a:b; }
 
inline ll power (ll a,ll p){
    ll res = 1, x = a;
    while ( p ) {
        if ( p & 1 ) res = ( res * x );
        x = ( x * x ); p >>= 1;
    }
    return res;
}
 
template <typename T> ostream& operator<<(ostream& os, const vector<T> &p){os << "[ "; for (T x: p) os << x << " "; os << "]" << endl; return os;}
template <typename T> ostream& operator<<(ostream& os, const set<T> &p){os << "{ "; for (T x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const map<Tk, Tv> &p){os << "{ "; for (pair<Tk, Tv> x: p) os << x << " "; os << "}" << endl; return os;}
template <typename Tk, typename Tv> ostream& operator<<(ostream& os, const pair<Tk, Tv> &p){os << "{" << p.first << ',' << p.second << "}";return os;}

int main() {
    boost;

    ll n;
    cin>>n;

    if (n%10==9 || n/10==9)
        cout<<"Yes\n";
    else
        cout<<"No\n";

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n, a, b, A = 0, B = 0;
	while (1){
		A = 0;
		B = 0;
		cin >> n;
		if (n == 0){ break; }
		for (int i = 0; i < n; i++){
			cin >> a >> b;
			if (a > b){
				A = A + a + b;
			}
			else if (a < b){
				B = B + a + b;
			}
			else if(a==b){
				A = A + a;
				B = B + b;
			}
		}
		cout << A << " " << B << endl;
	}
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>


#define INF             1e9
#define INFL            1e19
#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cout << endl;
#define HOISE           cout << "hoise" << endl
#define PAUSE           system("pause")
#define DEBUG(x)        cout << #x << " = " << x << endl
#define READ            freopen("alu.txt", "r", stdin)
#define WRITE           freopen("vorta.txt", "w", stdout)
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)

#define MASK(x)         for(int i = 0; i < 8; i++){ if(x&(1<<i)){ cout << i << " "; } } cout << endl;

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pff;

const int MAX = 200000 + 2;
const int MAXLOG = log2(MAX) + 2;
const int MAXN = 1e6 + 2;
const int MOD = 1000000007;
const double PY = acos(-1.0);

int main()
{
//    READ;
//    WRITE;
    FASTIO;

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

    return 0;
}




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

using namespace std;

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

	int ans = 0;
	for (int i = 1; i <= sqrt(x); i++)
	{
		for (int j = 2; j <= 10; j++)
		{
			int tmp = pow(i, j);
			if (tmp <= x)
			{
				ans = max(ans, tmp);
			}
			else
			{
				break;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b' ');
    let m: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut bv = vec![0; m];
    for _ in 0..n {
        let k: u8 = read(&mut stdin_lock, &mut buf, b' ');
        for _ in 0..(k - 1) {
            let a: usize = read(&mut stdin_lock, &mut buf, b' ');
            bv[a - 1] += 1;
        }
        let a: usize = read(&mut stdin_lock, &mut buf, b'\n');
        bv[a - 1] += 1;
    }
    let ans = bv.iter().filter(|x| **x == n).count();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>
 
int main(void)
{
    while (1) {
        char str1[201];
        scanf("%s", str1);
 
        if (str1[0] == '-')
            break;
 
        int m;
        scanf("%d", &m);
 
        int i;
        for (i = 0; i < m; i++) {
            int h;
            scanf("%d", &h);
 
            char str2[h];
 
            int j;
            for (j = 0; j < h; j++)
                str2[j] = str1[j];
 
            for (j = 0; str1[h + j] != '\0'; j++)
                str1[j] = str1[h + j];
 
            int k = j;
 
            for (j = 0; j < h; j++)
                str1[k + j] = str2[j];
        }
 
        printf("%s\n", str1);
    }
 
    return 0;
}


Measured memory_bytes: 2132