akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cstdlib>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
const int MOD = 1000000007;

long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
  ll N,M,ans=0;
  cin >> N >> M;
  if(N>2 && M>2) ans=(N-2)*(M-2);
  else if(N==1 && M==1) ans=1;
  else if(N==1) ans = M-2;
  else if(M==1) ans = N-2;
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
#define Inf 1000000000000
using namespace std;

int main() {
  int64_t x, y, A, B, C, D;
  cin >> x >> y;
  if (x<=y) {
    A=y-x;
  }
  else {
    A=Inf;
  }
  if (-x<=y) {
    B=y+x+1;
  }
  else {
    B=Inf;
  }
  if (x<=-y) {
    C=-y-x+1;
  }
  else {
    C=Inf;
  }
  if (-x<=-y) {
    D=-y+x+2;
  }
  else {
    D=Inf;
  }
  C=min(C,D);
  B=min(B,C);
  A=min(A,B);
  cout << A << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define ll long long
#define int long long
#define ld long double
#define pii pair <int , int>
#define pll pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const int maxn = 3e5 + 2 , N = 2e6 + 10 , SQ = 320 , base = 1999 , mod = 1e9 + 7 , INF = -1e9 , lg = 33;

int n , m , u , v , p, c , t[2] , h[maxn] , mark[maxn];
int ans;
vector <int> g[maxn];

void dfs(int x) {
    mark[x]=1;
    for (int i = 0; i < g[x].size(); ++i)
        if(mark[g[x][i]] && h[x] == h[g[x][i]])
            c = 1;
    for (int i = 0; i < g[x].size(); ++i)
        if(!mark[g[x][i]])
            h[g[x][i]] = h[x] ^ 1 , dfs(g[x][i]);
}

int32_t main() {
    cin >> n >> m;
    p = n;
    for (int i = 0; i < m; ++i) {
        cin >> u >> v;
        g[u].PB(v);
        g[v].PB(u);
    }
    for (int i = 1; i <= n; ++i)
        if(!mark[i]) {
            if(g[i].size()) {
                c = 0;
                dfs(i);
                t[c]++;
            }
            else ans += p * 2 - 1 , p--;
        }
    ans += 1ll * (t[0] + t[1]) * (t[0] + t[1]) + 1ll * t[0] * t[0];
    cout << ans;
}


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

int solver() {
  int n, m;
  cin >> n >> m;

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

  if (n == 1 and m == 0) return 0;
  if (n == 2 and m == 0) return 10;
  if (n == 3 and m == 0) return 100;

  int minDigit = 1000000;
  for (int i = 0; i < m; i++) {
    int s, c;
    cin >> s >> c;
    if (num[s-1] != c and num[s-1] != -1) {
      return -1;
    }
    if (minDigit > s) minDigit = s;
    num[s-1] = c;
  }

  if (num[minDigit - 1] == 0) {
    if (minDigit == 1 and n != 1) return -1;
  }

  if (num[0] == -1) num[0] = 1;

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (num[n-1-i] > 0) {
      ans += num[n-1-i] * pow(10, i);
    }
  }
  return ans;
}

int main() {
  int ans = solver();
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>

using namespace std;
typedef long long int ll;

int main(){

    ll N;
    cin >> N;

    cout << pow(N, 3) << endl;

} 

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

const int INF = 1001001001;
int dp[1000001][2];

int main(int argc, char const* argv[])
{
  string s;
  cin>>s;

  reverse(ALL(s));
  s += '0';
  int n = s.size();
  REP(i,n+1)REP(j,2) dp[i][j] = INF;
  dp[0][0] = 0;
  REP(i,n)REP(j,2) {
    int x = s[i] - '0';
    x += j;
    REP(a,10) {
      int ni = i+1, nj = 0;
      int b = a-x;
      if(b<0) {
        nj = 1;
        b += 10;
      }
      dp[ni][nj] = min(dp[ni][nj], dp[i][j]+a+b);
    }
  }
  int ans = dp[n][0];

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9220
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		int[] arr = r.ria();
		int a = arr[1]-arr[0]-1;		
		print((a*(a+1))/2-arr[0]);
	}
	
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
}

class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
}


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

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

int main() {
  map<string, int> bset;
  map<string, int> rset;
  int N;
  cin >> N;
  string s;
  for(int i = 0; i < N; ++i) {
    cin >> s;
    bset[s]++;
  }
  int M;
  cin >> M;
  for(int i = 0; i < M; ++i) {
    cin >> s;
    rset[s]++;
  }
  int ans = 0;
  for(auto b : bset) {
    chmax(ans, b.second - rset[b.first]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>

using namespace std;
typedef long long ll;

int CountLunLun(ll X){
	int num[15];
	int column = 0;
	int first = -1;
	
	ll temp = X;
	for(int i = 0; i < 15; i++){
		num[i+1] = temp % 10;
		if(temp > 0){ column ++;}
		if(temp > 0 && temp < 10) { first = temp; }
		temp = temp / 10;
	}
	
	/*
	cout << "num : ";
	for(int i = 15; i > 0; i--){
		cout << num[i];
	}
	cout << endl;
	*/
	
	int dp[15][15][3]; // 桁、数字、未満フラグ
	for(int i = 0; i < 15; i++){
		for(int j = 0; j < 15; j++){
			dp[i][j][0] = 0; // 下の二つ以外
			dp[i][j][1] = 0; // それより大きい桁が与えられた数と一致する
			dp[i][j][2] = 0; // 与えられた数より桁数が少なく、見ている数については注目している数字が最大の桁である
		}
	}
	dp[column][first][1] = 1;
	for(int i = 1; i < first; i++){
		dp[column][i][0] = 1;
	}
	
	for(int i = column - 1; i > 0; i--){
		for(int j = 0; j < 10; j++){
			if(j > 0){
				dp[i][j][2] = 1;
			}
			
			if(j == num[i]){
				dp[i][j][1] += dp[i+1][j][1];
				if(j != 0) { dp[i][j][1] += dp[i+1][j-1][1];}
				if(j != 9) { dp[i][j][1] += dp[i+1][j+1][1];}
				
			}
			else if(j < num[i]){
				dp[i][j][0] += dp[i+1][j][1];
				if(j != 0) { dp[i][j][0] += dp[i+1][j-1][1];}
				if(j != 9) { dp[i][j][0] += dp[i+1][j+1][1];}
			}
			
			dp[i][j][0] += dp[i+1][j][0];
			if(j != 0) { dp[i][j][0] += dp[i+1][j-1][0];}
			if(j != 9) { dp[i][j][0] += dp[i+1][j+1][0];}
			
			dp[i][j][0] += dp[i+1][j][2];
			if(j != 0) { dp[i][j][0] += dp[i+1][j-1][2];}
			if(j != 9) { dp[i][j][0] += dp[i+1][j+1][2];}
		}
	}
	
	int sum = 0;
	for(int i = 0; i < 10; i++){
		sum += dp[1][i][0];
		sum += dp[1][i][1];
		sum += dp[1][i][2];
		//cout << i << " : " << dp[1][i][0] << " , " << dp[1][i][1] << " , " << dp[1][i][2] << endl;
	}
	
	return sum;
}

int main()
{
	int K;
	cin >> K;
	
	ll min = 0;
	ll max = 3234566667;
	
	while(max - min > 0){
		ll mid = min + (max-min)/2;
		// cout << min << " " << max << endl;
		int count = CountLunLun(mid);
		if(count >= K){
			max = mid;
		}else{
			min = mid + 1;
		}
	}
	
	cout << max << endl;
	
	return 0;
}

Measured memory_bytes: 256
// AtCoder My Practice
// author: Leonardone @ NEETSDKASU

// 9
// 0 1 1 0 1 2 2 1 2
// 
// 0 0 0 0 0 0 0 0 0
// 0 0 1 0 0 0 0 0 0 [1]
// 0 1 1 0 0 0 0 0 0 [2]
// 0 1 1 0 0 0 0 1 0 [3]
// 0 1 1 0 0 0 0 1 2 [4]
// 0 1 1 0 0 1 0 1 2 [5]
// 0 1 1 0 0 1 2 1 2 [6]
// 0 1 1 0 1 1 2 1 2 [7]
// 0 1 1 0 1 2 2 1 2 [8]
//
// 2
// 0 2 
//
// -1 
//
// 4
// 0 1 2 3
//
// 0 0 0 0
// 0 1 0 0 [1]
// 0 1 2 0 [2]
// 0 1 2 3 [3]
//
// 5
// 0 1 2 3 2
// 
// 0 0 0 0 0
// 0 0 0 1 0 [1]
// 0 0 0 1 2 [2]
// 0 1 0 1 2 [3]
// 0 1 2 1 2 [4]
// 0 1 2 3 2 [5]
//
// 6
// 0 1 2 3 4 3
//
// 0 0 0 0 0 0
// 0 0 0 1 0 0 [1]
// 0 0 0 1 2 0 [2]
// 0 0 0 1 2 3 [3]
// 0 1 0 1 2 3 [4]
// 0 1 2 1 2 3 [5]
// 0 1 2 3 2 3 [6]
// 0 1 2 3 4 3 [7]
//

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    let n = get!(usize);
    let mut xs = vec![0; n];
    let mut ans = 0;
    for i in 0..xs.len() {
    	xs[i] = get!();
        if i > 0 {
        	let d = xs[i] - xs[i-1];
        	if d > 1 {
            	ans = -1;
                break;
            }
            if d < 1 {
            	ans += xs[i-1];
            }
        } else if xs[i] != 0 {
        	ans = -1;
            break;
        }
    }
    if ans >= 0 && n > 1 {
    		ans += xs[n-1];
    }
    println!("{}", ans);
}

Measured memory_bytes: 8444
fun main (args : Array<String>) {
	val (n, m) = readLine()!!.split(" ")
	val N : Int = n.toInt()
	val M : Int = m.toInt()
	val x = readLine()!!.split(" ")
	var list1 : MutableList<Int> = mutableListOf()
	var list2 : MutableList<Int> = mutableListOf()
	var result : Int = 0
	if (N >= M) {
		return println("0")
	}
	for (i in x) {
		list1.add(i.toInt())
	}
	list1.sort()
	for (i in 1..M - 1) {
		list2.add(list1[i] - list1[i - 1])
	}
	list2.sort()
	for (i in 0..N - 2) {
		list2.removeAt(list2.size - 1)
	}
	//println("${list2}")
	for (i in 0..list2.size - 1) {
		result += list2[i]
	}
	println("${result}")
	
}

Measured memory_bytes: 49024
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define PUTS(x) cout << (x) << endl;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())
#define MOD 1000000007

vector<Int> IntsIn(int n) {
    auto v = vector<Int>(0);
    for (int i = 0; i < n; i++) {
        Int a;
        cin >> a;
        v.push_back(a);
    }
    return v;
}
int main() {
    Int n, k;
    cin >> n >> k;
    auto a = IntsIn(n);
    sort(ALL(a));
    auto L = a[n - 1];
    if (k == 0) {
        PUTS(L)
        exit(0);
    }
    long double M = L;
    long double m = 0;
    while (M - m >= 0.00000001L) {
        auto x = (M + m) / 2;
        auto c = 0LL;
        for (auto &p : a) {
            c += ceil(p / x) - 1;
            if (c > k) {
                break;
            }
        }
        if (c <= k) {
            M = x;
        } else {
            m = x;
        }
        x = (M + m) / 2;
    }
    Int x = ceil(M);
    Int y = ceil(m);
    if (x != y) {
        PUTS(y)
    } else {
        PUTS(x)
    }
}


Measured memory_bytes: 5376
import sys
from collections import deque


IN = sys.stdin.readlines()
N = int(IN[0])

edge = [[] for _ in range(N)]
for i in range(1, N):
    a, b, c = map(int, IN[i].split())
    a -= 1; b -= 1
    edge[a].append((b, c))
    edge[b].append((a, c))

Q, K = map(int, IN[N].split())

q = deque()
path = [float('inf')] * N
path[K - 1] = 0
q.append((K - 1, 0))
while q:
    p, step = q.popleft()
    for np, d in edge[p]:
        if path[np] > step + d:
            q.append((np, step + d))
            path[np] = step + d

for i in range(N + 1, N + 1 + Q):
    x, y = map(int, IN[i].split())
    x -= 1; y -= 1
    Kx = path[x]
    Ky = path[y]
    print(Kx + Ky)


Measured memory_bytes: 65388
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < n; i++)

int main() {
	int n, l;
	cin >> n >> l;
	vector<string> vec(n);
	rep(i, n) cin >> vec[i];
	sort(vec.begin(), vec.end());
	rep(i, n) cout << vec[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
#include <iomanip>
//#include <stdlib.h>
//#include <cctype>

using namespace std;

const int MAX_N = 1000000;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)

void printVec(std::vector<int> & vec)
{
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it)
	{
		std::cout << *it << " ";
	}
	cout << '\n';
}
void printVec1(std::vector<string>& vec)
{
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it)
	{
		std::cout << *it << " ";
	}
	cout << '\n';
}
void printVec2(std::vector<Int>& vec)
{
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it)
	{
		std::cout << *it << " ";
	}
	cout << '\n';
}

Int gcd(Int a, Int b)
{
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b)
{
	return a / gcd(a, b) * b;
	//a*bは64bit integer overflow
}

bool integer(double num)
{
	return floor(num) == num;
}

Int fact(int num)
{
	if (num == 0)
		return 1;
	else
		return num * fact(num - 1);
}

int main() {
	IOS;
	// cout << fixed << setprecision(20);
	// int a;cin >> a;
	// string s;cin>>s;
	Int n,k;cin >> n >> k;
	
	vector<int> a(n), b;
	for (int i = 0; i <n;i++){
		cin >> a[i];
	}
	Int cnt = 0,cnt2=0;
	Int ans = 0;
	for (int i = 0; i <n;i++){
		int num = a[i];
		cnt = 0;
		cnt2 = 0;
		for (int j = i+1; j <n;j++){
			if(num>a[j])cnt++;
		}
		for (int k = 0; k <n;k++){
			if(num>a[k])cnt2++;
		}
		ans+=k*(k-1)/2%MOD*cnt2%MOD+k*cnt%MOD;
		ans%=MOD;
	}

	cout << ans;

	cout << endl;
	return 0;
}

/*
テレビも無ェ ラジオも無ェ
自動車もそれほど走って無ェ
ピアノも無ェ バーも無ェ
巡査 毎日ぐーるぐる
朝起ぎで 牛連れで
二時間ちょっとの散歩道
電話も無ェ 瓦斯も無ェ
バスは一日一度来る
俺らこんな村いやだ 俺らこんな村いやだ
東京へ出るだ 東京へ出だなら
銭コァ貯めで 東京でベコ(牛)飼うだ
*/


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

using namespace std;

#define chmin(a,b) a=min(a,b)
#define rep(i,x) for(int i=0;i<(x);++i)

const int inf = 1e9;

int N, M;
int mc[100][100], mt[100][100];

void wf()
{
    rep(k, M) rep(i, M) rep(j, M) {
        chmin(mc[i][j], mc[i][k] + mc[j][k]);
        chmin(mt[i][j], mt[i][k] + mt[j][k]);
    }
}

int main()
{
    while (scanf("%d %d", &N, &M), N || M) {
        fill(mc[0], mc[M], inf);
        fill(mt[0], mt[M], inf);

        rep(i, M) mc[i][i] = mt[i][i] = 0;

        rep(i, N) {
            int a, b, cost, time; scanf("%d %d %d %d", &a, &b, &cost, &time); a--; b--;
            mc[a][b] = mc[b][a] = cost;
            mt[a][b] = mt[b][a] = time;
        }

        wf();

        int K; scanf("%d", &K);
        rep(i, K) {
            int p, q, r; scanf("%d %d %d", &p, &q, &r); p--; q--;
            printf("%d\n", r == 0 ? mc[p][q] : mt[p][q]);
        }
    }
}

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

int main(){

  int N, M; cin >> N >> M;
  
  priority_queue<int> price_list;
  
  for(int i=0; i<N; i++){
    int price; cin >> price;
    price_list.push(price);
  }
  
  for(int i=0; i<M; i++){
    int price = price_list.top();
    price_list.pop();
    price /= 2;
    price_list.push(price);  
  }
  
  long long sum = 0;
  for(int i=0; i<N; i++){
    sum += price_list.top();
    price_list.pop();
  }
  cout << sum << endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

int main(){
  int n,m;
  cin >> n >> m;
  int ans = 0;
  if(n!=0)ans += n*(n-1)/2;
  if(m!=0)ans += m*(m-1)/2;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N, H, W;
    cin >> N >> H >> W;
    cout << (H - N - 1) * (W - N - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N,i,temp,max=0,count=0;
  cin>>N;
  int H[N];
  for(i=0;i<N;i++){
    cin>>H[i];
  }  
  for(i=1;i<N;i++){
    if(H[i-1]>=H[i]){
      count++;
      if(max<count){
        max=count;
      }
    }
    else{
      if(max<count){
        max=count;
      }
      count=0;
    }
  }
  cout<<max<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

vector<long long> enum_divisor(long long n)
{
  vector<long long> dst;
  for (long long i = 1; i * i <= n; i++)
  {
    if (n % i != 0)
      continue;
    dst.push_back(i);
    if (i * i != n)
      dst.push_back(n / i);
  }
  return dst;
}

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  vector<bool> is_exist(1e6 + 10, false);
  vector<bool> is_kabutru(1e6 + 10, false);
  map<int, int> henkan;
  bool one_is_exist = false;
  rep(i, N)
  {
    cin >> A[i];
    if (is_exist[A[i]])
      is_kabutru[A[i]] = true;
    is_exist[A[i]] = true;
    if (A[i] == 1)
      one_is_exist = true;
    henkan[A[i]] = i;
  }
  vector<int> count(N, 0);

  rep(i, N)
  {
    vector<long long> divis = enum_divisor(A[i]);
    rep(j, divis.size())
    {
      if (is_kabutru[A[i]])
      {
        count[i]++;
        break;
      }

      if (A[i] == divis[j])
        continue;
      if (is_exist[divis[j]])
      {
        count[i]++;
        continue;
      }
    }
  }

  int ans = 0;
  rep(i, N)
  {
    if (count[i] == 0)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 14176
s = []
for c in input():
    s.append(int(c))


def dfs(list, ops, index, sum):
    if len(list) <= index:
        if sum == 7:
            return "{}{}{}{}{}{}{}=7".format(list[0], ops[0], list[1], ops[1], list[2], ops[2], list[3])
        else:
            return None
    candidate = dfs(list, ops + ['+'], index + 1, sum + list[index])
    if candidate:
        return candidate
    candidate = dfs(list, ops + ['-'], index + 1, sum - list[index])
    if candidate:
        return candidate
    return None


print(dfs(s, [], 1, s[0]))


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

#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, s, n) for(int i = s; i < n; i++)
#define MOD 1e9+7
void max_self(int &a, int b) { a=a>b?a:b; }
void min_self(int &a, int b) { a=a<b?a:b; }

using namespace std;

int n, h;
int temp;
int cumm;

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

    rep(i, n) {
        cin >> temp;
        cumm += temp;
    }

    if(cumm>=h)
        cout << "Yes";
    else
        cout << "No";
    cout << endl;


    return 0;
}


Measured memory_bytes: 256
import numpy as np

n,m,x=map(int,input().split())
ca=[]
for _ in range(n):
  ca.append(list(map(int,input().split())))
# print(ca)
minimum=10**7

for i in range(2**n):
#  print(i)
  tmp=[]
  tmp2=[0]*(m+1)
  cnt=0
  for j in range(n):
    if ((i >> j) & 1):
      tmp.append(ca[j])
      cnt+=1
#  print(tmp)
  for k in range(cnt):
    for l in range(m+1):
      tmp2[l]+=tmp[k][l]
# print(tmp2)
  if min(tmp2[1:])>=x:
    minimum=min(minimum,tmp2[0])
print(minimum if minimum < 10**7 else '-1')

Measured memory_bytes: 27184
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		// 文字列の入力
		String s = sc.next();
		// 出力
      		if ( n % 2 == 0 ) {
              if( s.substring(n/2).equals(s.substring(0,n/2)) ) {
				System.out.println("Yes");
	      	  }else {
				System.out.println("No");
              }
            }else {
				System.out.println("No");
		    }
	}
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

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


int main(){
	
	int n;cin >> n;
	vector<pair<ll,P>> v;
	
	REP(i,n){
		ll a,b;cin >> a >> b;
		v.PB(MP(a+b,MP(a,b)));
	}
	
	sort(ALL(v),greater<pair<ll,P>>());
	
	ll ans = 0;
	REP(i,n){
		if(i % 2 == 0){
			ans += v[i].SE.FI;
		}
		else {
			ans -= v[i].SE.SE;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4852
using System;
//using System.Collections.Generic;

namespace Project
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = int.Parse(Console.ReadLine());
			}
			int min = int.MaxValue;
			int ans = int.MinValue;
			for (int i = 1; i < n; i++)
			{
				if (min > a[i - 1]) min = a[i - 1];
				if (ans < a[i] - min) ans = a[i] - min;
			}
			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 10956
#include<bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define pri(x) printf("%d\n", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define imprime(v) for(int X=0;X<v.size();X++) printf("%d ", v[X]); printf("\n");
#define endl "\n"
const int INF= 0x3f3f3f3f;
const long double pi= acos(-1);
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< vector< int > > vvi;
const int MOD=1e9+7;
const ll LINF=0x3f3f3f3f3f3f3f3f;
const int MAXN = 200005;
bool tempron[MAXN];
bool temdo1[MAXN];
int n, m;
int main() {
  sc2(n, m);
  for(int i = 0; i < m; i++) {
    int a, b;
    sc2(a, b);
    if(a > b) swap(a, b);
    if(a == 1) temdo1[b] = true;
    if(b == n) tempron[a] = true;
  }
  for(int i = 1; i <= n; i++) {
    if(temdo1[i] and tempron[i]) {
      puts("POSSIBLE");
      return 0;
    }
  }
  puts("IMPOSSIBLE");
  return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    static Scanner scan;
    static int count = 0;

    public static void main(String[] args) {
        scan = new Scanner(System.in);

         // get input
         final int slen = scan.nextInt();
         int[] s = new int[slen];
         for(int i = 0; i < slen; i++) {
             s[i] = scan.nextInt();
         }

         final int tlen = scan.nextInt();
         int[] t = new int[tlen];
         for(int i = 0; i < tlen; i++){
             t[i] = scan.nextInt();
         }

         // carry out binary search
         for(int i = 0; i < tlen; i++) {
             binarySearch(s, t[i]);
         }

         System.out.println(count);
    }

    public static void binarySearch(int[] s, int t){
        int hi = 0; int ti = s.length-1; //先頭のインデックス; 末尾のインデックス;
        int p;

        while(hi <= ti) {
            p = (hi + ti) / 2; //探索対象インデックス
            if(s[p] == t) {
                count++;
                break;
            } else if(s[p] < t) {
                hi = p + 1;
                continue;
            } else {
                ti = p - 1;
                continue;
            }
        }

        return;
    }
}



Measured memory_bytes: 67720
function Main(s) {
	s = s.split("\n").map(a => parseInt(a));
	const n = s[0];
	s = s[1];
	const sn = Math.ceil(Math.sqrt(n));
	if(s === n){console.log(n+1);return;}
	for(var b = 2; b < sn; b++){
		if(s === f(b, n)){
          console.log(b);
          return;
        }
	}
	var p = Math.floor((n - s) / (sn - 1));
	for(; p > 0; p--){
		b = Math.floor((n - s) / p + 1);
		if(s === f(b, n)){
          console.log(b);
          return;
        }
	}
	
	console.log(-1);
}
function f(b, n){
	if(n < b) return n;
	return f(b, Math.floor(n / b)) + n % b;
}

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

Measured memory_bytes: 10060
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int x, y; cin >> x >> y;
	int ans = 1;
	int now = x;
	while (true) {
		now *= 2;
		if (now > y) {
			cout << ans << endl;
			return 0;
		}
		else {
			ans++;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
//#include <iostream>
//#include <sstream>
using namespace std;
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define deb(x) cout << #x" = " << x << '\n'
#define debd(x) pf("%s = %d\n", #x, x)
#define debs(x) pf("%s = %s\n", #x, s)
#define debll(x) pf("%s = %lld\n", #x, x)
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
//typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
//bitmask
int onbit(int x, int pos) {x |= (1 << pos); return pos;}
int offbit(int x, int pos) {x &= ~(1 << pos); return x;}
int test(int x, int pos) {return x & (1 << pos);}
int flip(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int onbitall(int x, int pos) {x = (1 << pos)-1; return x;}
//constants
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
//moves
const int dx1[] = {0, 1, 0, -1};
const int dy1[] = {1, 0, -1, 0};
const int dx2[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int dy2[] = {-1, 0, 1, -1, 1, -1, 0, 1};


int main() {
//    freopen("input.in", "r", stdin);
	int a, b;
	sf("%d %d", &a, &b);
	if(a == 1) a+= INF;
	if(b == 1) b += INF;
	bool draw = (a==b);
	
	if(draw) puts("Draw");
	else puts(a > b ? "Alice" : "Bob");
	return 0;
}

Measured memory_bytes: 128
// Problem : C - Traveling Salesman around Lake
// Contest : AtCoder Beginner Contest 160
// URL : https://atcoder.jp/contests/abc160/tasks/abc160_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Problem : Divide them all
// Contest : CodeChef - Code Invicta
// URL : https://www.codechef.com/GHC32020/problems/MOON
// Memory Limit : 256 MB
// Time Limit : 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
 
 
 
 
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << " --> " << x << endl;
 
#define deb1a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        cout << it << " ";        \
    }                             \
    cout << endl;
#define deb2a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        for (auto it1 : it)       \
        {                         \
            cout << it1 << " ";   \
        }                         \
        cout << endl;             \
    }
#define mod 998244353
#define so(v) sort(v.begin(),v.end())
#define fi first
#define se second
int power(int x, unsigned int y, int p){ int res = 1;x = x % p;while (y > 0)  { if (y & 1)res = (res*x) % p;y = y>>1;  x = (x*x)% p;} return res;}


int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int p, n;
    cin>>p>>n;
    int ans=1e9;
    vec v(n);
    fo(i,n)
    {
        cin >> v[i];
    }
    ans = v[n - 1] - v[0];
    foo(i,1,n){
        ans = min(ans, p - (v[i] - v[i - 1]));
    }
    cout << ans;
} 

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  ll n; cin >> n;
  ll ans=0;
  for(ll i=1; i<=n; i++){
    if(i*(i+1)/2>=n){
      ans=i;
      break;
    }
  }
  for(int i=1; i<=ans; i++){
    if(ans*(ans+1)/2-n==i)continue;
    cout << i << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;

int main() {
  string s;
  cin >> s;
  int minm = 1e8;
  for(int i = 2; i < (int)s.size(); i++) {
    int ans = (s[i-2] - '0')*100 + (s[i-1] - '0')*10 + (s[i] - '0');
    minm = min(minm, abs(753-ans));
  }
  cout << minm << endl;
  return 0;
}
    

Measured memory_bytes: 3560
w = input()
d = {}
for s in w:
    if d.get(s, -1) == -1:
        d[s] = 1
    else:
        d[s] += 1
good = True
for key in d:
    if d[key] % 2 != 0:
        good = False
        break
print('Yes' if good else 'No')



Measured memory_bytes: 9104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	int K,T;
	cin>>K>>T;
	vector<int> a(T);
	int maxa = -INF;
	rep(i,T){
		cin>>a[i];
		maxa = max(maxa,a[i]);
	}

	int ans = max(0,maxa - (K-maxa)-1);

	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
ll cnt[100001] = {};
int main() {
	int n; ll k; cin >> n >> k;
	rep(i, n) {
		int a; ll b; cin >> a >> b;
		cnt[a] += b;
	}
	rep(i, 100001) {
		k -= cnt[i];
		if (k <= 0) {
			cout << i << endl; break;
		}
	}
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    cout << (char)toupper(s1.at(0))
    << (char)toupper(s2.at(0))
    << (char)toupper(s3.at(0)) << endl;

    return 0;
}

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

int main(void) {

  int L, R, d;
  
  cin >> L >> R >> d;
  
  int a = d;
  while (a < L) a += d;
  
  if (a > R) cout << 0 << '\n';
  else {
  	int count = 0;
    while (a <= R) {
    	a += d;
      	count++;
    }
    cout << count << '\n';
  }
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,q;
  cin >> n >> k >> q;
  vector<int> a(q),p(n,k-q);
  for(int i=0;i<q;i++){
    cin >> a[i];
    p[a[i]-1]++;
  }
  for(int i=0;i<n;i++){
    if(p[i]>0){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 1408
/// In The Name Of God

#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()

#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)

#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

using namespace std;

int n, k;
int cnt[N];	
int main() {
	#ifdef wws
		freopen ("in.txt", "r", stdin);
	#endif
	cin >> n >> k;
	rep(i, 1, n) cnt[i % k]++;
	ll ans = 0;
	rep(a, 0, k - 1) {
		if (!cnt[a]) continue;
		if (((k - a) * 2) % k == 0) {
			// cout << a << " -> " << (k - a) << " -> ";
			ans += (ll)cnt[a] * sqr(cnt[(k - a) % k]);
			// cout << ans << nl;
		}
	}
	cout << ans;
	ioi 
}
/*
\




(a + b) = k * x1
(b + c) = k * x2
(a + c) = k * x3

a + b = k
b + c = k
a + c = k

b = k - a
c = k - a

(k - a) * 2 = k
*/

Measured memory_bytes: 640
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define cerr cout
#define F first
#define S second
#define fori(i,a,b) for (i = a; i < b; ++i)
#define ford(i,a,b) for(i = a; i>=b;--i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int(x.size())
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <bool> vb;
typedef vector < char> vc;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fill(a, x) memset(a, x, sizeof(a))
#define INF 1000000000
#define MOD 1000000007
#define SMOD 998244353
#define endl "\n"
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
const ll N = 100043;
ll fact[N];
ll add(ll x, ll y)
{
	x += y;
	while(x >= MOD) x -= MOD;
	while(x < 0) x += MOD;
	return x;
}
ll mul(ll x, ll y)
{
	return (x * 1ll * y) % MOD;
}
ll mulmod(ll a, ll b)
{
    ll res = 0;
    a = a % MOD;
    while (b>0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
        a = (a * 2) % MOD;
        b /= 2;
    }
    return res % MOD; 
}
ll binpow(ll x, ll y)
{
	ll z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}
ll inv(ll x)
{
	return binpow(x, MOD - 2);
}
ll divide(ll x, ll y)
{
	return mul(x, inv(y));
}
void precalc()
{
	fact[0] = 1;
	ll i;
	fori(i, 1, N)
		fact[i] = mul(i, fact[i - 1]);
}
ll C(ll n, ll k)
{
	if(k > n)
	    return 0;
	return divide(fact[n], mul(fact[n - k], fact[k]));
}

void solve()
{
    string st;
    cin >> st;
    ll k = 0, i;
    fori(i, 0, sz(st))
    {
        k += (st[i]-48);
        if(k>=9)
            k = k-9;
    }
    if(k%9 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    t=1;
    // cin >> t;
    for(int i=1; i<=t; i++)
    {
        // cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3780
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

struct Node {
    int key;
    Node *prev;
    Node *next;
};

Node *nil;

void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil->prev = nil;
    nil->next = nil;
}

void insert(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;

    x->next = nil->next;
    x->prev = nil;
    nil->next->prev = x;
    nil->next = x;
}

Node* listSearch(int key) {
    Node *cur = nil->next;
    while (cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void deleteNode(Node *t) {
    if (t == nil) return;
    t->next->prev = t->prev;
    t->prev->next = t->next;
    free(t);
}

void deleteFirst() {
    deleteNode(nil->next);
}

void deleteLast() {
    deleteNode(nil->prev);
}

void deleteKey(int key) {
    deleteNode(listSearch(key));
}

void printList() {
    Node *cur = nil->next;
    while(cur != nil) {
        if(cur != nil->next) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;

    }
    printf("\n");
}

int main(void) {
    int key, n, i;
    char com[20];

    scanf("%d", &n);
    init();
    for(i = 0; i < n; i++){
        scanf("%s%d", com, &key);
        if (com[0] == 'i') insert(key);
        if (com[0] == 'd') {
            if (com[6] == 'F') deleteFirst();
            else if (com[6] == 'L') deleteLast();
            else deleteKey(key);
        }

    }

    printList();

    return 0;
}


Measured memory_bytes: 34468
#include<bits/stdc++.h>
#define int long long int
#define endl "\n"
using namespace std;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin >> t;
    while (t--) {
        int n;
        cin>>n;
        int count=0,x;
        for(int i=1;i<=n;i++){
            cin>>x;
            if(i&1 &&x&1){
                count++;
            }
        }
        cout<<count<<endl;
    }
    return 0;
}

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

int h, w;
string cline;

int main() {
  cin >> h >> w;
  rep (i, h) {
    cin >> cline;
    cout << cline << endl;
    cout << cline << endl;
  }
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
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 long long INFLL = 1LL<<60;
const int INF = 1<<28;
const long long MOD =1000000000+7;
void solve(int a){cout<<( a?"Yes":"No")<<endl;}
int main(){
    int a,b,c;
    cin >>a>>b>>c;
	bool ans=false;
	if(((a==b) + (c==a) + (b==c))==1){
		ans=true;
	}
    solve(ans);
}

Measured memory_bytes: 256
import numpy as np
import math

N = int(input())
a = list(map(int, input().split()))
a = np.asarray(a)

ans = 0
while(1):
    if a.max() < N:
        break
    
    for i in range(a.size):
        if a[i] > (N-1):
            diff = math.ceil((a[i] - (N-1))/N)
            
            a[i] -= N * diff
            a[:i] += 1 * diff
            a[i+1:] += 1 * diff

            ans += diff
print(ans)

Measured memory_bytes: 22172
#include<bits/stdc++.h>
using namespace std;
double dp[3200];
main()
{
	int t;
	scanf("%d",&t);
	dp[0]=1;
	for(int i = 0;i < t;i++)
	{
		double p,ps;
		scanf("%lf",&p);
		ps=1;
		ps-=p;
		for(int j = i+1;j>=0;j--)
		{
			double pp=dp[j];
			dp[j+1]+=pp*p;
			dp[j]=0;
			dp[j]=pp*(ps);
		}
	}
	double cc=0;
	for(int i = 0;i <= t;i++)
	{
		if(i>t/2)
		cc+=dp[i];
	}
	printf("%.12f",cc);
}

Measured memory_bytes: 384
#include<stdio.h>
#define M 10000
int main(){
  int n,i,m;
  scanf("%d",&n);
  char s[M];
  scanf("%s",s);
  m=0;
  while(s[m]!=0)
    m++;
  for(i=0;i<m;i++){
    if(s[i]+n<'Z'+1)
      s[i]=s[i]+n;
    else
      s[i]=s[i]+n-26;
  }
  for(i=0;i<m;i++)
    printf("%c",s[i]);
  printf("\n");
  return 0;}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    string s, A, B;
    cin >> s;
    int q, f = 0;
    cin >> q;
    while(q--){
        int t;
        cin >> t;
        if(t == 1){
            f ^= 1;
        }else {
            int a; char c;
            cin >> a >> c;
            a--; a ^= f;
            if(a){
                B += c;
            }else {
                A += c;
            }
        }
    }
    if(f){
        reverse(B.begin(),B.end());
        reverse(s.begin(),s.end());
        cout << B << s << A << "\n";
    }else {

        reverse(A.begin(),A.end());
        cout << A << s << B << "\n";
    }
    return 0;
}

Measured memory_bytes: 1088