akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            C();
        }

        static void C()
        {
            var NY = ReadSplitInt();
            var N = NY[0];
            var Y = NY[1];

            for (int a = 0; a <= N; a++)
            {
                for (int b = 0; b <= N; b++)
                {
                    var c = N - a - b;
                    if (c >= 0 && a * 10000 + b * 5000 + c * 1000 == Y)
                    {
                        Println($"{a} {b} {c}");
                        return;
                    }
                }
            }
            Println("-1 -1 -1");
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}

Measured memory_bytes: 13268
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Comparator;

public class Main {
	private static final int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		Pair[] p = new Pair[M];
		for (int i = 0; i < p.length; i++) {
			p[i] = new Pair(sc.nextInt(), sc.nextInt());
		}

		Arrays.sort(p, Comparator.comparing(Pair::getB));

		int last = -1;
		int count = 0;
		for (int i = 0; i < p.length; i++) {
			if (last <= p[i].a) {
				last = p[i].b;
				count++;
			}
		}

		System.out.println(count);
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	private static class Pair {
		int a;
		int b;

		public Pair(int a, int b) {
			super();
			this.a = a;
			this.b = b;
		}

		public int getA() {
			return a;
		}

		public int getB() {
			return b;
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}

Measured memory_bytes: 47240
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=100005;
const ll p=998244353ll;
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
inline int myabs(int a){return a<0?-a:a;}
int main(){
	int n,i,l,s=0,m=N,d,k;
	scanf("%d%d",&n,&l);
	for(i=0;i<n;++i){
		s+=l+i;
		k=myabs(l+i);
		if(k<m){m=k;d=l+i;}
	}
	printf("%d",s-d);
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func main() {
	N, K := ReadInt(), ReadInt()
	x := make([]int, N)
	y := make([]int, N)
	for i := 0; i < N; i++ {
		x[i], y[i] = ReadInt(), ReadInt()
	}
	ans := math.MaxInt64
	for leftIdx := 0; leftIdx < N; leftIdx++ {
		for rightIdx := 0; rightIdx < N; rightIdx++ {
			for bottomIdx := 0; bottomIdx < N; bottomIdx++ {
				for topIdx := 0; topIdx < N; topIdx++ {
					left, right := x[leftIdx], x[rightIdx]
					bottom, top := y[bottomIdx], y[topIdx]
					if right < left || top < bottom {
						continue
					}

					cnt := 0
					for i := 0; i < N; i++ {
						if left <= x[i] && x[i] <= right && bottom <= y[i] && y[i] <= top {
							cnt++
							if cnt == K {
								continue
							}
						}
					}
					if cnt < K {
						continue
					}
					s := (right - left) * (top - bottom)
					if ans > s {
						ans = s
					}
				}
			}
		}
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1876
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = sc.nextInt();
    Integer[] a = new Integer[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }
    Arrays.sort(a);
    int count = 0;
    boolean flag = true;
    for (int i = 0; i < n; i++) {
      if (x - a[i] >= 0) {
        x -= a[i];
        count++;
      } else {
        flag = false;
        break;
      }
    }
    if (x > 0 && flag) count--;
    System.out.println(count);
  }
}

Measured memory_bytes: 36048
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)){
            a = a - 1;
        }else{
            b = b - 1;
        }
        System.out.println(a + " " + b);


    }
}

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

int c[3][3];

int main(){
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    bool yes = true;
    for(int i = 0; i < 3 - 1; i++){
        yes = yes && (c[i+1][0] - c[i][0] == c[i+1][1] - c[i][1]) && (c[i+1][1] - c[i][1] == c[i+1][2] - c[i][2]);
    }
    if(yes){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import sys
import numpy as np
# from numba import njit

# @njit(cache=True)
def calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):
	cycleID = 0

	for n in range(N):

		v = n
		currentCycleItemCnt = 0
		currentCycleTotal = 0

		if cycleIDs[v] != -1:
			continue
			# print(currentCycleItemCnt, currentCycleTotal)
		else:
			while True:
				# 全頂点について、属するサイクルを計算する
				currentCycleItemCnt += 1
				currentCycleTotal += C[v]

				v = P[v]
				if v == n:
					# サイクル発見
					cycleIDs[v] = cycleID
					cycleItemCnts[cycleID] = currentCycleItemCnt
					cycleTotalScores[cycleID] = currentCycleTotal
					cycleID += 1
					break

				# 一応、一度サイクルを計算した頂点については、
				# その頂点の属するサイクルの情報をメモっておく。。。
				cycleIDs[v] = cycleID

def upd(P,C,K,v,ans,currentCycleItemCnt,currentCycleTotal):

	# procCnt = 0
	currentCycleSumTmp = 0

	for k in range(min(K,currentCycleItemCnt)):

		# 頂点vにコマが置かれた時の最高スコアを計算し、
		# これまでの最高スコアを上回ったら、これまでの最高スコアを更新する

		procCnt = k+1
		currentCycleSumTmp += C[v]

		cycleLoopCnt = 0
		if 0 < currentCycleTotal:
			cycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt

		# print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)
		ans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )
		v = P[v]

	return ans





def main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores):

	ans = -1e18

	for n in range(N):

		v = n
		currentCycleItemCnt, currentCycleTotal = cycleItemCnts[ cycleIDs[v] ], cycleTotalScores[ cycleIDs[v] ]

		ans=upd(P,C,K,v,ans,currentCycleItemCnt,currentCycleTotal)
			# procCnt = k+1
			# currentCycleSumTmp += C[v]

			# cycleLoopCnt = 0
			# if 0 < currentCycleTotal:
			# 	cycleLoopCnt = ( K - procCnt ) // currentCycleItemCnt

			# # print("v=", v, "currentCycleSumTmp=", currentCycleSumTmp, "procCnt, cycleLoopCnt, currentCycleTotal=", procCnt, cycleLoopCnt, currentCycleTotal)
			# ans = max( ans, currentCycleSumTmp + cycleLoopCnt * currentCycleTotal )
			# v = P[v]

	print(int(ans))

if sys.argv[-1]=='ONLINE_JUDGE':
	# from numba import njit
	from numba.pycc import CC
	cc=CC('my_module')
	cc.export('calcCycle','void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])')(calcCycle)
	# cc.export('main','void(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:])')(main)
	cc.export('upd','i8(i8[:],i8[:],i8,i8,i8,i8,i8)')(upd)
	# cc.export('upd','UniTuple(i8,3)(i8[:],i8[:],i8,i8,i8,i8,i8)')(upd)
	# main=njit(main, cache=True)
	cc.compile()
	exit(0)
from my_module import upd,calcCycle
# from my_module import calcCycle



if __name__ == "__main__":
	N,K = map(int,input().split())
	P = np.array( input().split(), np.int64 )
	P -= 1
	C = np.array( input().split(), np.int64 )

	# 一度計算したサイクル情報を一応キャッシュしておく。。。
	# あんまり意味なさそう
	cycleIDs = np.full( N, -1, dtype=np.int64 )
	cycleItemCnts = np.full( N, -1, dtype=np.int64 )
	cycleTotalScores = np.full( N, -1, dtype=np.int64 )

	calcCycle(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)

	# print(cycleItemCnts)


	main(N,K,P,C,cycleIDs,cycleItemCnts,cycleTotalScores)
	#print(ans)




Measured memory_bytes: 28064
#include <iostream>

int main()
{
    int h, w;

    std::cin >> h >> w;

    int array[w][h] = {};

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

    int row[w] = {};
    for (int i = 0; i < w; i++) {
        std::cin >> row[i];
    }


    int ans[h] = {};
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                        ans[i] += array[j][i] * row[j];
                }
            }

    for (int i = 0; i < h; i++ ) {
        std::cout << ans[i] << std::endl;

    }

}

Measured memory_bytes: 3132
#include <stdio.h>
int main(void){
	int n,k,x,y,i,ans=0;
	scanf("%d %d %d %d",&n,&k,&x,&y);
	if(k<n){
		for(i=0;i<k;i++){
			ans+=x;
		}
		for(i=k;i<n;i++){
			ans+=y;
		}
	}
	else{
		for(i=0;i<n;i++){
			ans+=x;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

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

  int ans = (n+1)*n/2;
  cout << ans << endl;  
  
  return 0;
}


Measured memory_bytes: 3556
from collections import deque

n,q = map(int,input().split())
cnt = [0]*(n+1)
g=[[] for _ in range(n+1)]

for _ in range(n-1):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
  
for _ in range(q): 
  v,val=map(int,input().split())
  cnt[v]+=val    
  
q = deque()
q.append(1)
checked = [0]*(n+1) 
while q:
  v = q.pop()
  checked[v] = 1
  for vc in g[v]:
    if checked[vc] == 1:
      continue
    else:
      cnt[vc] += cnt[v]
      q.append(vc)
    
print(*cnt[1:])        

Measured memory_bytes: 56060
use proconio::*;

fn main() {
    input! {
        n: i128,
        m: String,
    };

    let v: Vec<i128> = m.split('.').map(|x| x.parse().unwrap()).collect();

    let ans = n * (v[0] * 100 + v[1]) / 100;

    println!("{}", ans);
}


Measured memory_bytes: 2196
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

using namespace std;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

using ll = long long;
constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T gcd(T u, T v) {
    ll r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T lcm(T u, T v) {
    return u * v / gcd(u, v);
}

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

    string S;
    cin >> S;

    string a;
    REP(i, S.length()) {
        a += (i % 2 == 0) ? "0" : "1";
    }

    int c = 0;
    REP(i, S.length()) {
        if (S[i] == a[i])c++;
    }

    cout << min(c, (int)S.length() - c) << endl;
    return 0;

}

Measured memory_bytes: 592
#include <cstdio>
#include <algorithm>

using namespace std;

#define long long long

const long INF = 1e18;

long n, a[50];

void Solve()
{
    long res = INF;
    for (int rem = 0; rem < n + 1; ++rem)
    {
        bool check = true;
        long sum = 0;
        for (int i = 0; check && i < n; ++i)
            if ((a[i] + rem) % (n + 1) == n) check = false;
            else
                sum += (a[i] + rem) / (n + 1);
        if (!check || sum < rem) continue;
        res = min(res, (sum - rem) * (n + 1) + rem);      // indeed correct
    }
    printf("%lld", res);
}

int main()
{
    scanf("%lld", &n);
    for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
    Solve();
    return 0;
}


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

//GCD 最大公約数
int64_t GCD(int64_t a,int64_t b){
    if(a<b) swap(a,b);
    int64_t d=a%b;
    if(d==0){
        return b;
    }
    return GCD(b,d);
}

int main() {
	int a;
    cin>>a;
    long long sum=0;
    for(int i=0;i<a;i++){
        for(int j=0;j<a;j++){
            for(int k=0;k<a;k++){
                int x=GCD(GCD(i+1,j+1),k+1);
                sum+=x;
            }
        }
    }
    cout<<sum<<endl;
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

const int maxn = 305;
LL N,M,L;


LL c1[maxn][maxn];
LL c2[maxn][maxn];


void floyd(LL G[maxn][maxn]){
    _rep(k,1,N){
        _rep(i,1,N){
            _rep(j,1,N){
                //(i,j) + (j,k) compare with (i,k);
                if(j == i || j == k || i == k) continue;
                LL &w = G[i][j];
                LL &a = G[i][k];LL &b = G[k][j];
                if(a != inf && b != inf){
                    LL d = a + b;
                    if(d < w) w = d;
                }
            }
        }
    }
}




int main()
{
    cin >> N >> M >> L;

     _rep(i,0,N){
        _rep(j,0,N){
            c1[i][j] = inf;
        }
    }


    _for(i,0,M){
        int A,B,C;
        cin >> A >> B >> C;
        c1[A][B] = (c1[B][A] = C);

    }

    floyd(c1);
    _rep(i,0,N){
        _rep(j,0,N){
            if(c1[i][j] <= L) c2[i][j] = 1;
            else c2[i][j] = inf;
        }
    }

    floyd(c2);

    int Q;cin >> Q;
    _for(i,0,Q){
        int s,t;
        cin >> s >> t;
        if(c2[s][t] == inf) cout << -1 <<endl;
        else cout << c2[s][t] - 1 <<endl;
    }



    return 0;
}


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

#define iosx ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(20)
#define hell 1000000007LL
#define INF 100000000000000000LL
#define hmap unordered_map
#define hset unordered_set
#define PQ priority_queue
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define lld long double
#define ll int
#define all(C) begin(C),end(C)
#define rep(i,a,b) for(ll i = (a); i < (b); ++(i))
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define pii pair<ll,ll>
#define len(C) (ll)(C).size()
#define lexcmp lexicographical_compare
#define whats(C,n) 	rep(i,0,n) cout<<(C)[i]<<" \n"[i+1==n]

ll vis[100005];
vector<pii> adj[100005];

void dfs(ll i, ll pa){
	vis[i]=pa;

	for(auto x: adj[i])
		if (vis[x.F]==-1)
			dfs(x.F, (x.S%2==0?pa:(1-pa)));
}

void solve(int tm){
	ll n;
	cin>>n;

	ll u,v,w;
	rep(i,0,n-1){
		cin>>u>>v>>w;
		adj[u].pb({v,w});
		adj[v].pb({u,w});
	}

	rep(i,1,n+1)
		vis[i]=-1;

	dfs(1,0);

	rep(i,1,n+1)
		cout<<vis[i]<<' ';
}

// g++.exe -static -DONLINE_JUDGE -lm -s -x c++ -Wl,--stack=268435456 -O2 -std=c++14 sol.cpp & a.exe & del a.exe
// vim cli: !g++ -static -lm -s -x c++ -O2 -std=c++14 sol.cpp -o out; ./out; 
int main(){ 
	iosx; 
	int t=1;
    // cin >> t;

	for(int i=1; i<=t; ++i)
        solve(i);

	return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main(){
    int x; cin >> x;
    vector<bool> expo(x+1);

    expo[1] = 1;
    for(int b = 2; b <= x; b++){
        int v = b * b;
        while(v <= x){
            expo[v] = 1;
            v *= b;
        }
    }
    for(int i=x; i>=1; i--) if(expo[i]){
        cout << i << endl;
        return 0;
    }
}

Measured memory_bytes: 256
import java.util.*;

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

        ArrayList<Integer> na = new ArrayList<>();
        for(int i=0; i<a.size(); i++) {
            na.add(a.get(i)+1);
            na.add(a.get(i)-1);
            na.add(a.get(i));
        }

        Map<Integer,Integer> m = new HashMap<>();
        for(int i: na) {
            if(m.containsKey(i)) {
                m.put(i, m.get(i)+1);
            } else {
                m.put(i, 1);
            }
        }

        int ans = 0;
        for(int i: m.keySet()) {
            ans = Math.max(ans, m.get(i));
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 67648
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

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


/* dijkstra(G,s,dis)
    入力：グラフ G, 開始点 s, 距離を格納する dis
    計算量：O(|E|log|V|)
    副作用：dis が書き換えられる
*/
void dijkstra(const graph &g, int s, vector<long long> &dis) {
    int N = g.size();
    dis.resize(N, INF);
    priority_queue<P, vector<P>, greater<P>> pq;  // 「仮の最短距離, 頂点」が小さい順に並ぶ
    dis[s] = 0;
    pq.emplace(dis[s], s);
    while (!pq.empty()) {
        P p = pq.top();
        pq.pop();
        int v = p.second;
        if (dis[v] < p.first) {  // 最短距離で無ければ無視
            continue;
        }
        for (auto &e : g[v]) {
            if (dis[e.to] > dis[v] + e.cost) {  // 最短距離候補なら priority_queue に追加
                dis[e.to] = dis[v] + e.cost;
                pq.emplace(dis[e.to], e.to);
            }
        }
    }
}
 
 
 int main(){
   ll n, m ; cin>>n>>m ;
   UnionFind uf(n) ;
    rep(i,m){
      ll a,b ; cin>>a>>b ;
      a-- ;b-- ;
      uf.unite(a,b) ;
    } 
    
  ll ans= -INF ;
  rep(i,n){
    chmax(ans,uf.size(i)) ;
  }
  cout<<ans<<endl ;
   return 0;
  }

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()

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

const int INF = 1e9;
const int MAX = 1e5;

// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visit[MAX]; // 訪問の有無

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 n; // 変数
int h[MAX];
int dp[MAX]; // 足場iまでの最小コスト

// メモ化再帰
int rec(int i) {
    if (dp[i] != INF) return dp[i];
    if (i == 0) return dp[i] = 0;
    if (i == 1) return dp[i] = abs(h[i]-h[i-1]);
    int x = rec(i-1) + abs(h[i]-h[i-1]);
    int y = rec(i-2) + abs(h[i]-h[i-2]);
    return dp[i] = min(x, y);
}

// DP
int dp_solve() {
    rep(i, n) {
        if (i == 0) dp[i] = 0;
        else if (i == 1) dp[i] = abs(h[i]-h[i-1]);
        else {
            int x = dp[i-1] + abs(h[i]-h[i-1]);
            int y = dp[i-2] + abs(h[i]-h[i-2]);
            dp[i] = min(x, y);
        }
    }
    return dp[n-1];
}

int main() {
// input
    cin >> n;
    rep(i, n) {
        cin >> h[i];
    }
// solve
    rep(i, n) {
        dp[i] = INF;
    }
    // int ans = rec(n-1);
    int ans = dp_solve();
// output
    cout << ans << "\n";
}

Measured memory_bytes: 4336
# ABC097B - Exponential
def main():
    X = int(input())
    cand = {1}
    for i in range(2, int(X ** 0.5) + 1):
        p = 2
        while i ** p <= X:
            cand.add(i ** p)
            p += 1
    ans = max(cand)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <stdio.h>

int main()
{
	char s[4];
  	scanf("%s", s);
  
  	if (s[1] == s[2]){
    	if (s[0] == s[1] || s[2] == s[3]) {
        	printf("Yes");
        } else {
        	printf("No");
        }
    } else {
        	printf("No");
    }
}

Measured memory_bytes: 128
inputted = list(map(int, input().split()))
N = inputted[0]
L = inputted[1]

delicious = (lambda L: lambda i: L + i - 1)(L)
delicious_N = sum([delicious(i) for i in range(1, N + 1)])


i = -L + 1
i = max(1, i)
i = min(i, N)
delicious2 = delicious(i)

answer = delicious_N - delicious2

print(answer)


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

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

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

int main() {
    ll A, B;
    cin >> A >> B;
    for (ll i = 0; i < 10000; ++i) {
        if (i * 8 / 100 == A && i / 10 == B) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

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

int main() {
    int n;  
    cin >> n;
    int ans = 200 / 2;
    for ( int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        int b = 0;
        while (a % 2 == 0) {
            a /= 2;
            ++b;
        }
        ans = min(ans, b);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    string a,b,c;
    cin>>a>>b>>c;
    a[0]-=32;
    c[0]-=32;
    b[0]-=32;
    cout <<a[0]<<b[0]<<c[0];
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
#define F first
#define S second

inline int in(){int X, Y; Y = scanf("%d", &X); return X; }

const int N = -1;
const ld EPS = 1e-12;

bool eq(ld a, ld b){
	return abs(a-b) < EPS;
}

struct PT{
	ld X, Y;
	PT (ld X = 0, ld Y = 0) : X(X), Y(Y) {}
	PT operator + (PT ro) const{
		return PT(X+ro.X, Y+ro.Y);
	}
	PT operator - (PT ro) const{
		return PT(X-ro.X, Y-ro.Y);
	}
	PT operator * (ld co) const{
		return PT(X*co, Y*co);
	}
	PT operator / (ld co) const{
		return PT(X/co, Y/co);
	}
	ld operator * (PT ro) const{
		return X*ro.X + Y*ro.Y;
	}
	ld operator ^ (PT ro) const{
		return X*ro.Y - Y*ro.X;
	}
	void operator -= (PT ro){
		(*this) = (*this) - ro;
	}
};

istream& operator>> (istream &is, PT &p){
	ld val;
	is >> val;
	p.X = val;
	is >> val;
	p.Y = val;
	return is;
}

PT operator * (ld co, PT p){
	return p*co;
}

ld len(PT a){
	return sqrt(a*a);
}

PT unit(PT a){
	return a/len(a);
}

PT clrot(PT a){
	return PT(-a.Y, a.X);
}

PT proj(PT a, PT b, PT c){
	b = b-a, c = c-a;
	return a + (b*c)/(b*b)*b;
}

PT reflect(PT a, PT b, PT c){
	PT d = c;
	b = b-a, c = c-a;
	return d + (c^b)/len(b)*clrot(unit(b))*2;
}

int sgn(PT a, PT b, PT c){
	ld cr = (b-a)^(c-a);
	return cr > EPS ? 1 : (cr + EPS < 0 ? -1 : 0);
}

bool intersect(PT a, PT b, PT c, PT d){
	int as = sgn(c, d, a),
		bs = sgn(c, d, b),
		cs = sgn(a, b, c),
		ds = sgn(a, b, d);
	if (as && as == bs || cs && cs == ds)
		return false;
	else if (as || bs || cs || ds)
		return true;
	for (int j = 0; j < 2; j++){
		ld mX = min(a.X, b.X),
		   MX = max(a.X, b.X),
		   mY = min(a.Y, b.Y),
		   MY = max(a.Y, b.Y);
		for (int k = 0; k < 2; k++){
			if (c.X + EPS > mX && c.X < MX + EPS && c.Y + EPS > mY && c.Y < MY + EPS)
				return true;
			swap(c, d);
		}
		swap(a, c);
		swap(b, d);
	}
	return false;
}

PT intersection(PT a, PT b, PT c, PT d){
	ld c1 = (b-a)^(c-a), c2 = (b-a)^(d-a);
	return (c1*d - c2*c)/(c1 - c2);
}

int main(){
	cout << setprecision(10) << fixed;
	for (int i = in(); i; i--){
		PT a, b, c, d;
		cin >> a >> b >> c >> d;
		PT o = intersection(a, b, c, d);
		cout << o.X << ' ' << o.Y << '\n';
	}
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //const ll p = 1e9 + 7;
    //const ll p = 998244353;
    
    clock_t start = clock();
    
    ll d;
    cin >> d;
    vector<ll> c(26);
    for (ll i = 0; i < 26; i++) cin >> c[i];
    vector<vector<ll>> s(d, vector<ll>(26));
    for (ll i = 0; i < d; i++) {
        for (ll j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    
    random_device rand;
    vector<ll> ans(d);
    for (ll i = 0; i < d; i++) ans[i] = rand() % 26;
    
    auto calc_score = [&] () {
        vector<ll> v(26, -1);
        ll ret = 0;
        for (ll i = 0; i < d; i++) {
            v[ans[i]] = i;
            ret += s[i][ans[i]];
            for (ll j = 0; j < 26; j++) {
                ret -= c[j] * (i - v[j]);
            }
        }
        return ret;
    };
    
    ll score = calc_score();
    
    while (clock() - start <= 1.95 * CLOCKS_PER_SEC) {
        ll change_at1 = rand() % d, into1 = rand() % 26;
        ll change_at2 = rand() % d, into2 = rand() % 26;
        ll memo1 = ans[change_at1], memo2 = ans[change_at2];
        ll memo_score = score;
        ans[change_at1] = into1; ans[change_at2] = into2;
        score = calc_score();
        if (score < memo_score && clock() - start > CLOCKS_PER_SEC) {
            ans[change_at1] = memo1; ans[change_at2] = memo2;
            score = memo_score;
        }
    }
    
    for (ll i = 0; i < d; i++) cout << ans[i] + 1 << endl;
    xout << score << endl;
}

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

int main() {
 int n;
 scanf("%d", &n);
 int sum = 0;
 for (int i = 1; i <= n; i++) {
   int l, r;
   scanf("%d %d", &l, &r);
   sum += (r - l + 1);
 }
 printf("%d", sum);
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App{
  val sc = new Scanner(System.in)
  val o = sc.nextLine()
  val e = sc.nextLine()

  var ans = ""
  for(i <- 1 to o.length){
    ans += o(i-1)
    if(i <= e.length){
      ans += e(i-1)
    }
  }
  println(ans)
}


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

using namespace std;
#define ll long long 
#define db long double

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

ll temp=n;

vector<ll> v;


if(n==1)
cout<<'a';
else
{
while(temp!=0)
{
    ll val=temp%26;
   
   if(val==0)
   {
       v.push_back(26);
       temp=temp/26;
       temp--;
       
   }

else
{
    temp=temp/26;  
   v.push_back(val);
    
}   
    
}

for(ll i=v.size()-1;i>=0;i--)
{
char c='a'+v[i]-1;
cout<<c;
}
}


    return 0;
}

Measured memory_bytes: 3584
import sys
n=int(input())
h=[int(x) for x in input().split()][::-1]

for i in range(n-1):
    if h[i]>=h[i+1]:
        continue
    elif h[i]==h[i+1]-1:
        h[i+1]-=1
    else:
        print("No")
        sys.exit()
print("Yes")        



Measured memory_bytes: 14252
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

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


//想定解答との絶対誤差または相対誤差が 10−6以下の場合+1以上だしておく。適当に15とかでもおｋ．
//cout << fixed << setprecision(15);

int main() {
    int K;
    cin >> K;
    ll ans = 0;
    rep(i, 1, K+1) {
        rep(j, 1, K+1) {
            rep(k, 1, K+1) {
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3620
// AGC44-A
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

ll n,a,b,c,d;
map<ll,ll> dp;
ll dfs(ll x){ //x→0にかかる最小のコストを計算
    if(x==0) return 0;
    if(x==1) return d; //1以外のxは1で止まるので、1のときは別で用意しておかないと無限ループに。
    if(dp.count(x)==1) return dp[x]; //一度計算したことあったら、再度計算しない。

    ll cur=pow(10,18); //+-1のみをつかってx→0にするときのコスト
    if(x<=cur/d) cur=x*d; 

    ll r2=(x+1)/2*2;
    ll l2=x/2*2;
    ll r3=(x+2)/3*3;
    ll l3=x/3*3;
    ll r5=(x+4)/5*5;
    ll l5=x/5*5;
    cur=min(cur,(r2-x)*d+a+dfs(r2/2));
    cur=min(cur,(x-l2)*d+a+dfs(l2/2));
    cur=min(cur,(r3-x)*d+b+dfs(r3/3));
    cur=min(cur,(x-l3)*d+b+dfs(l3/3));
    cur=min(cur,(r5-x)*d+c+dfs(r5/5));
    cur=min(cur,(x-l5)*d+c+dfs(l5/5));
    dp[x]=cur;
    return cur;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int t;
    cin>>t;
    rep(i,t){
        dp.clear();
        cin>>n>>a>>b>>c>>d;
        cout<<dfs(n)<<endl;
    }
    return 0;
}

Measured memory_bytes: 4368
n,m=map(int,input().split())
H=list(map(int,input().split()))
AB=[list(map(int,input().split())) for _ in range(m)]
M=[[] for _ in range(n+1)]

for a,b in AB:
    M[a].append(b)
    M[b].append(a)

cnt=0
for i in range(1,n+1):
    height=H[i-1]
    flag=1
    for j in M[i]:
        if height<=H[j-1]:
            flag=0
            break
    if flag:cnt +=1

print(cnt)

Measured memory_bytes: 112964
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define MOD 1000000007
#define MAXLEVEL 60

vector<vector<vector<long long>>> cc;

vector<vector<long long>> matrix_multiply(vector<vector<long long>> a, vector<vector<long long>> b) {
	long long x = a.size(), y = a[0].size(), z = b[0].size(), i, j, k;

	vector<vector<long long>> ans(x, vector<long long>(z, 0));

	for (i = 0; i < x; i++) {
		for (j = 0; j < z; j++)
			for (k = 0; k < y; k++) ans[i][j] = (ans[i][j] + a[i][k] * b[k][j]) % MOD;
	}

	return ans;
}

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

	long long n, k, i, j, ans;
	cin >> n >> k;
	vector<vector<long long>> a(n, vector<long long>(n)), v(1, vector<long long>(n, 1));
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) cin >> a[i][j];
	}

	cc.resize(MAXLEVEL);
	cc[0] = a;
	for (i = 1; i < MAXLEVEL; i++) cc[i] = matrix_multiply(cc[i - 1], cc[i - 1]);

	for (i = 0; i < MAXLEVEL; i++) {
		if ((1LL << i) & k) v = matrix_multiply(v, cc[i]);
	}

	ans = 0;
	for (i = 0; i < n; i++) ans = (ans + v[0][i]) % MOD;

	cout << ans << "\n";



	return 0;
}





Measured memory_bytes: 1664
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    if (s == t) {
      cout << "Yes" << endl;
      return 0;
    }
    s = s[s.size() - 1] + s.substr(0, s.size() - 1);
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3532
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int w,h,n,sx = 0,sy = 0;

    cin >> w >> h >> n;
    for(int i = 0;i < n;i++){
        int x,y,a;
        cin >> x >> y >> a;

        switch(a){
            case 1:
                sx = max(sx,x);
                break;
            case 2:
                w = min(w,x);
                break;
            case 3:
                sy = max(sy,y);
                break;
            case 4:
                h = min(h,y);
                break;
        }
    }
    int s ;
    if((w-sx) < 0 || (h-sy) < 0)s= 0;
    else s = (w-sx)*(h-sy);
    cout << s << endl;
    return 0;
}

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

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

    int x[n];
    for(int i = 0; i < n; i++)  cin >> x[i];

    int ans = INT_MAX;
    for(int l = 0; l <= n-k; l++){
        int r = l+k-1;
        if((x[l] < 0 && x[r] < 0) || (x[l] > 0 && x[r] > 0)){
            ans = min(ans, max(abs(x[l]), abs(x[r])));
        }else{
            ans = min(ans, 2 * min(abs(x[l]), abs(x[r])) + max(abs(x[l]), abs(x[r])) );
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include <bits/stdc++.h>
using namespace std;
#define int int32_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l=0,int r=INT_MAX)
{return uniform_int_distribution<int>(l,r)(rng);}

template <typename T,typename G>
ostream& operator << (ostream& out, const pair<T,G> &a) 
{return out<<"( "<<a.x<<", "<<a.y<<")";}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &a) 
{out<<"[ ";for(const auto &i:a)out<<i<<", ";return out<<"]"<<endl;}

template <typename T>
ostream& operator << (ostream& out, const set<T> &a) 
{out<<"{ ";for(const auto &i:a)out<<i<<", ";return out<<"}"<<endl;}

template <typename T,typename G>
ostream& operator << (ostream& out, const map<T,G> &a) 
{out<<"< ";for(const auto &i:a)out<<i<<", ";return out<<">"<<endl;}

template<typename T, size_t N>
typename enable_if<!is_same<typename remove_cv<T>::type, char>::value,
ostream&>::type operator<<(ostream& out, T(&a)[N])
{out<<"[ ";for(size_t i=0;i<N;++i)out<<a[i]<<", ";out <<"]"<<endl;return out;}

void debug_out(){cerr<<endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr<<(H)<<" ";debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr<<"#"<<#__VA_ARGS__<<":\n",debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

int find(vector<int> &a, int x){
	int sm=0;
	for(auto &u:a){
		sm+=((u-x)*(u-x));
	}
	return sm;
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n,i;
	cin>>n;
	vector<int> a(n);
	for(auto &u:a){
		cin>>u;
	}
	int ans=1e9;
	for(i=1;i<101;i++){
		ans=min(ans,find(a,i));
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
int main(void)
{
    char st[1200];
    int c = 0,i;
    
    while(1){
        scanf("%c",&st[c]);
        if(st[c] == '\n')break;
        if((int)st[c] >= 97&&(int)st[c] <= 122)st[c] = (int)st[c] - 32;
        else
        if((int)st[c] >= 65&&(int)st[c] <= 90)st[c] = (int)st[c] + 32;
        c++;
    }
    
    for(i = 0;i < c;i++){
        printf("%c",st[i]);
    }
    printf("\n");
    return 0;
}

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

using namespace std;

#define int long long

const int N = (int)3e5, MOD = (int)1e9 + 7, INF = (int)3e18;

main() {
    ios :: sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int res = 0;
    int x = n;
    for (int i = 2; i <= sqrt(x); ++i) {
        int sz = 0;
        while (n % i == 0) {
            ++sz;
            n /= i;
        }
        int l = 0, r = 1e9, cnt = 0;
        while (l <= r) {
            int mid = (l + r) >> 1;
            if ((mid * (mid + 1)) / 2 <= sz) {
                cnt = mid;
                l = mid + 1;
            }
            else {
                r = mid - 1;
            }
        }
        res += cnt;
    }
    if (n > 1) ++res;
    cout << res;
    return 0;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h" // 提出時こちらで問題なし
using namespace std;

int main() {
	int num_L, num_R, num_d;
	cin >> num_L >> num_R >> num_d;

	int ans = 0;
	for (int i = num_L; i <= num_R; i++) {
		if (i % num_d == 0) {
			ans++;
		}
	}
	cout << ans;
	//system("pause"); // ローカルのコンソールで出力結果を確認する。提出時はコメントアウト。
}

Measured memory_bytes: 3592
import sys
sys.setrecursionlimit(10 ** 7)

N = int(input())


def rec(n, acc):
    if n < 26:
        return chr(n + 97) + acc
    else:
        m = n % 26
        return rec((n // 26) - 1, chr(m + 97) + acc)


print(rec(N-1, ""))


Measured memory_bytes: 9116
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mk make_pair
#define rint register int
using namespace std;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}return w*s;}
char s[1000010];
int n;int tong[2];
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);ll ans=0,ss=0;
	for(rint i=1;i<=n;++i)
	{
		if(s[i]=='W') ans+=ss;
		if(s[i]=='B') ss++;
	}cout<<ans;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#define N 50
using namespace std;

int n,m,c,i,j,res,b[N],a[N],ans;

int main()
{
    scanf("%d%d%d",&n,&m,&c);
    for(i=1;i<=m;i++) scanf("%d",&b[i]);
    for(i=1;i<=n;i++)
    {
        res=c;
        for(j=1;j<=m;j++)
        {
            scanf("%d",&a[j]);
            res+=b[j]*a[j];
        }
        if(res>0) ans++;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    ll N, P;
    cin >> N >> P;
    if(N == 1){
        cout << P << endl;
        return 0;
    }
    ll ans = 1;
    for(ll i = 2; i * i <= P; i++){
        ll cnt = 0;
        while(P % i == 0){
            P /= i;
            cnt++;
            if(cnt >= N){
                cnt = 0;
                ans *= i;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
MOD = 998244353
m = 2*10**5 + 5
fac = [0] * m
finv = [0] * m
inv = [0] * m


def COMBinitialize(m):
    fac[0] = 1
    finv[0] = 1
    if m > 1:
        fac[1] = 1
        finv[1] = 1
        inv[1] = 1
        for i in range(2, m):
            fac[i] = fac[i-1] * i % MOD
            inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
            finv[i] = finv[i - 1] * inv[i] % MOD


def COMB(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


COMBinitialize(m)


def main():
    N, M, K = (int(i) for i in input().split())
    ans = 0
    for k in range(K+1):
        ans += M * pow(M-1, N-k-1, MOD) * COMB(N-1, k)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73048