akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String s = saori.nextHayami();
		char x = s.charAt(0);
		s = saori.nextHayami();
		char y = s.charAt(0);
		if(x > y)System.out.println(">");
		else if(x < y) System.out.println("<");
		else System.out.println("=");
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 20948
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
#from math import floor, ceil
#from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
#inf = 10**17
#mod = 10**9 + 7

s=input().rstrip()
u=list(map(int,list(s)))
u=list(reversed(u))
#print(u)
n=len(u)
beki=[0 for i in range(n)]
beki[0]=1
for i in range(n-1):
    beki[i+1]=(beki[i]*10)%2019
#print(beki)
dp=[0 for i in range(n)]
dp[0]=beki[0]*u[0]
for i in range(n-1):
    dp[i+1]=(dp[i]+beki[i+1]*u[i+1])%2019
dp.append(0)
#print(dp)
c=Counter(dp)
ans=0
for l in c.values():
    ans+=(l*(l-1))//2
print(ans)


Measured memory_bytes: 25344
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

ll N;
map<ll, ll> S;

int main() {
    cin >> N;
    rep(i,0,1<<N) {
        ll s;
        cin >> s;
        S[s]++;
    }
    if (prev(S.end())->second >= 2) {
        cout << "No" << endl;
        return 0;
    }
    priority_queue<ll> queue;
    queue.push(N);
    for (auto it = next(S.rbegin()); it != S.rend(); ++it) {
        ll count = it->second;
        vector<ll> generated;
        rep(i,0,count) {
            if (queue.empty()) {
                cout << "No" << endl;
                return 0;
            }
            ll top = queue.top();
            queue.pop();
            if (top == 0) {
                cout << "No" << endl;
                return 0;
            }
            queue.push(top-1);
            generated.push_back(top-1);
        }
        for (ll life : generated) {
            queue.push(life);
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 18808
#coding:utf-8
op =""

while op != "?":
    a, op, b=input().rstrip().split(" ")
    a = int(a)
    b = int(b)
    if op =="?":
        break
    if op == "+":
        ans = a + b
    elif op =="-":
        ans = a - b
    elif op =="*":
        ans = a*b
    else:
        ans =int(a/b)
    print(ans)
            

Measured memory_bytes: 7636
#include<stdio.h>
#include<limits.h>
#define max 500000

int sum=0;
 
void margeSort(int s[],int l,int r){
  int m;
  if(l+1<r){
    m = (l+r)/2;
    margeSort(s,l,m);
    margeSort(s,m,r);
    marge(s,l,m,r);
  }
}
 
void marge(int s[],int l1,int m,int r1){
  int i,j,k,n1,n2;
  n1 = m - l1;
  n2 = r1 - m;
  int l[n1+1],r[n2+1];
  for(i=0;i<n1;i++) l[i]=s[l1+i];
  for(i=0;i<n2;i++) r[i]=s[m+i];
  l[n1] = INT_MAX;
  r[n2] = INT_MAX;
  i=0;
  j=0;
  for(k=l1;k<r1;k++){
    sum++;
    if(l[i] <= r[j]){
      s[k] = l[i];
      i++;
    }
    else {
      s[k] = r[j];
      j++;
    }
  }
}
 
int main(){
  int i,s[max],n;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&s[i]);
  margeSort(s,0,n);
  for(i=0;i<n-1;i++) printf("%d ",s[i]);
  printf("%d",s[n-1]);
  printf("\n%d\n",sum);
  return 0;
}

Measured memory_bytes: 4504
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = sc.nextInt();
    
    if (n < 10)
      x += 100 * (10 - n);
    
    System.out.println(x);
  }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int sp[111][111];
int dp[111][111][1<<5];
int w,h;
int in(int y,int x){
  return 0<=y&&y<h&&0<=x&&x<w;
}
struct sta{
  int y,x,b,d;
  sta(){}
  sta(int y,int x,int b,int d):y(y),x(x),b(b),d(d){}
  bool operator<(const sta& a) const{
    return d>a.d;
  }
};
typedef pair<int,int> P;
int main(){
  memset(sp,0,sizeof(sp));
  memset(dp,-1,sizeof(dp));
  cin>>w>>h;
  string st[h];
  for(int i=0;i<h;i++) cin>>st[i];
  int sy,sx,gy,gx,n=0;
  map<P,int> m;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      sp[i][j]=max(sp[i][j],1);
      if(st[i][j]=='M') m[P(i,j)]=n++;
      if(st[i][j]=='S') sy=i,sx=j;
      if(st[i][j]=='G') gy=i,gx=j;
      if(st[i][j]=='#'){
    for(int k=1;k<=3;k++){
      for(int a=-(4-k);a<=4-k;a++){
        if(in(i-(4-k),j+a)) sp[i-(4-k)][j+a]=max(sp[i-(4-k)][j+a],k);
        if(in(i+(4-k),j+a)) sp[i+(4-k)][j+a]=max(sp[i+(4-k)][j+a],k);
        if(in(i+a,j-(4-k))) sp[i+a][j-(4-k)]=max(sp[i+a][j-(4-k)],k);
        if(in(i+a,j+(4-k))) sp[i+a][j+(4-k)]=max(sp[i+a][j+(4-k)],k);
      }
    }
      }
    }
  }
  /*//
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout<<sp[i][j];
    }
    cout<<endl;
  }
  //*/
  priority_queue<sta> q;
  q.push(sta(sy,sx,0,0));
  dp[sy][sx][0]=0;
  int ax[]={1,-1,0,0};
  int ay[]={0,0,1,-1};
  while(!q.empty()){
    sta s=q.top();q.pop();
    if(dp[s.y][s.x][s.b]<s.d) continue;
    //cout<<s.y<<" "<<s.x<<" "<<s.b<<" "<<s.d<<endl;
    for(int k=0;k<4;k++){
      int ny=s.y+ay[k],nx=s.x+ax[k],nb=s.b,nd=s.d+sp[s.y][s.x];
      if(!in(ny,nx)) continue;
      if(st[ny][nx]=='#') continue;
      if(m.count(P(ny,nx))) nb|=1<<m[P(ny,nx)];
      if(dp[ny][nx][nb]<0||dp[ny][nx][nb]>nd){
    dp[ny][nx][nb]=nd;
    q.push(sta(ny,nx,nb,nd));
      }
    }
  }
  cout<<dp[gy][gx][(1<<n)-1]<<endl;
  return 0;
}

Measured memory_bytes: 4884
#include<iostream>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<functional>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

double const INF = 1e18;
struct range { 
  double ma, mi;
  range(): ma(-INF), mi(INF) {}
  range(double hi, double lo): ma(hi), mi(lo) {}
  void update(double v) {
    ma = std::max(ma, v);
    mi = std::min(mi, v);
  }
void print() const { std::cout << "[" << mi << ", " << ma << "]\n"; }
};

void add_time(std::vector<double>& ts, range r[3]) {
  auto add_one = [&](std::vector<double>& t, double v)->void { if(v >= 0 && v <= 2e8) t.push_back(v); };
  //up to stop;
  add_one(ts, r[1].ma - r[2].ma);
  add_one(ts, r[1].ma - r[2].mi);
  add_one(ts, r[1].mi - r[2].ma);
  add_one(ts, r[1].mi - r[2].mi);
  //down to stop;
  add_one(ts, r[0].ma - r[1].ma);
  add_one(ts, r[0].ma - r[1].mi);
  add_one(ts, r[0].mi - r[1].ma);
  add_one(ts, r[0].mi - r[1].mi);
  // up to down
  add_one(ts, (r[0].ma - r[2].ma)*0.5);
  add_one(ts, (r[0].ma - r[2].mi)*0.5);
  add_one(ts, (r[0].mi - r[2].ma)*0.5);
  add_one(ts, (r[0].mi - r[2].mi)*0.5);
}

double min_sq(double t1, double t2, std::function<double(double)>&& f) {
  double tm = (t1+t2)*0.5;
  double f1 = f(t1), f2 = f(t2), fm = f(tm);
  double fr = std::min(f1, f2);
  if(fm >= fr) return fr;
  double a = f1+f2-fm*2;
  double b = 2*(t1+t2) - (t1+tm)*f2 - (t2*tm)*f1;
  double tr = -b/a * 0.5;
  if(tr < t1 || t2 < tr) return fr;
  return std::min(fr, f(tr));
}


int main() {
  std::cout << std::setprecision(10) << std::fixed;
  int N; std::cin >> N;
  range x[3], y[3]; // 0:dec, 1:stop, 2:inc
  for(int i = 0; i < N; ++i) {
    double xx, yy; char d; std::cin >> xx >> yy >> d;
    switch(d) {
    case 'R': x[2].update(xx); y[1].update(yy); break;
    case 'L': x[0].update(xx); y[1].update(yy); break;
    case 'U': x[1].update(xx); y[2].update(yy); break;
    case 'D': x[1].update(xx); y[0].update(yy); break;
    }
  }
  std::vector<double> ts(1, 0);
  add_time(ts, x);
  add_time(ts, y);
  std::sort(ts.begin(), ts.end());
  ts.erase(std::unique(ts.begin(), ts.end()), ts.end());
  auto f = [&](double t) {
    auto calc = [](double t, range r[3]) {
      double ma = r[1].ma, mi = r[1].mi;
      ma = std::max(ma, r[0].ma - t);
      ma = std::max(ma, r[2].ma + t);
      mi = std::min(mi, r[0].mi - t);
      mi = std::min(mi, r[2].mi + t);
      return ma - mi;
    };
    return calc(t, x)*calc(t, y);
  };
  
  if(ts.size() < 2) fin(f(0));
  double ans = INF;
  for(int i = 0; i < ts.size()-1; ++i) ans = std::min(ans, min_sq(ts[i], ts[i+1], f));
  fin(ans);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] vals = sc.nextLine().split(" ");
        int x1 = getInt(vals[0]);
        int y1 = getInt(vals[1]);
        int x2 = getInt(vals[2]);
        int y2 = getInt(vals[3]);

        int xDiff = Math.abs(x2 - x1);
        int yDiff = Math.abs(y2 - y1);

        boolean isXPlus = x2 - x1 > 0;
        boolean isYPlus = y2 - y1 > 0;

        // ズレてるケースだけ
        int x3 = 0;
        int y3 = 0;
        int x4 = 0;
        int y4 = 0;
        if (isXPlus && isYPlus) {
            x3 = x2 + (yDiff * -1);
            y3 = y2 + xDiff;

            x4 = x3 + (xDiff * -1);
            y4 = y3 + (yDiff * -1);
        }
        if (!isXPlus && isYPlus) {
            x3 = x2 + (yDiff * -1);
            y3 = y2 + (xDiff * -1);

            x4 = x3 + xDiff;
            y4 = y3 + (yDiff * -1);
        }
        if (!isXPlus && !isYPlus) {
            x3 = x2 + yDiff;
            y3 = y2 + (xDiff * -1);

            x4 = x3 + xDiff;
            y4 = y3 + yDiff;
        }
        if (isXPlus && !isYPlus) {
            x3 = x2 + yDiff;
            y3 = y2 + xDiff;

            x4 = x3 + (xDiff * -1);
            y4 = y3 + yDiff;
        }

        System.out.println(x3 + " " + y3 + " " + x4 + " " + y4);
        sc.close();
    }
    static int getInt(String val) {
        return Integer.parseInt(val);
    }
    static long getLong(String val) {
        return Long.parseLong(val);
    }
}

Measured memory_bytes: 22996
package main

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

func main() {
	io, flush := NewIO()
	defer flush()

	n := io.ScanInt()
	nums := io.ScanInts(n)
	numCountMap := map[int]int{}
	for _, num := range nums {
		numCountMap[num]++
	}
	combCountMap := map[int]int{}
	var totalCombCount int
	for _, count := range numCountMap {
		combCount := CombCount(count, 2)
		combCountMap[count] = combCount
		totalCombCount += combCount
	}
	for _, num := range nums {
		io.Println(totalCombCount - (numCountMap[num] - 1))
	}
}

func CombCount(left int, right int) int {
	rightFac := Factorial(right, right)
	if rightFac <= 0 {
		return 0
	}
	return Factorial(left, right) / rightFac
}

func Factorial(n int, times int) (res int) {
	facts := make([]int, n+1)
	if facts[n] != 0 {
		res = facts[n]
		return res
	}

	if n > 0 && times > 0 {
		res = n * Factorial(n-1, times-1)
		return res
	}

	return 1
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 1000005), 1000005)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 18176
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include<algorithm>
#include <iomanip>

using namespace std;
typedef long long ll;
///定義場所///
int i, j, k, l, m, n;
int N, M, K;
ll MOD = 1000000007;
ll ans = 1000000000;

//関数リスト//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
//(注)pairの型・比較する場所(first/second)は毎回変えて使用する
bool pairCompare(const pair<ll, ll> firstElof, pair<ll, ll> secondElof)
{
	return firstElof.second > secondElof.second;
}
//////////////
int main()
{
	cin >> N;
	vector<ll>A(N);
	vector<ll>B(N);
	for (i = 0; i < N; i++) {
		cin >> A[i];
		if (i == 0) {
			B[i] = A[i];
		}
		else {
			B[i] = B[i - 1] + A[i];
		}
	}
	//真ん中の切れ込み位置を固定
	int leftMid = 0;
	int rightMid = 1;
	for (int mid = 1; mid <= N - 3; mid++) {
		ll leftMax, leftMin;
		while (abs(B[mid] - 2*B[leftMid]) > abs(B[mid]  - 2*B[leftMid + 1])) {
				leftMid++;
		}
		leftMax = max(B[leftMid], B[mid] - B[leftMid]);
		leftMin = min(B[leftMid], B[mid] - B[leftMid]);
		ll rightMax, rightMin;
		while (abs((B[N-1]-B[mid]) - 2*(B[rightMid]-B[mid])) > abs((B[N - 1] - B[mid])  - 2*(B[rightMid + 1]-B[mid]))) {
				rightMid++;
		}
		rightMax = max(B[rightMid]-B[mid], B[N-1] - B[rightMid]);
		rightMin = min(B[rightMid] - B[mid], B[N - 1] - B[rightMid]);
		ll allMax = max(leftMax, rightMax);
		ll allMin = min(leftMin, rightMin);
		ll res = allMax - allMin;
		ans = min(ans, res);
	}
	cout << ans;
}

Measured memory_bytes: 3456
#include <iostream>
#include <queue>
#include <algorithm>
#include <cstring>
#define INF 10050
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
//	while(cin>>n>>k)
//	{
		int sum = (1+n-2)*(n-2)/2;
		if(k>sum) {
			cout<<"-1"<<endl;
		}else{
			cout << (n-1) + sum - k <<endl;
			for(int i=2;i<=n;i++) {
				cout<<"1 "<<i<<endl;
			}
			
			for(int i=2; i<=n; i++) {
				for(int j=i+1; j<=n; j++) {
					if(sum == k)	return 0;
					cout<<i<<" "<<j<<endl;
					sum--;
				}
			}
		}
//	}
	
	
	
	
	
	
	
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fr(i,p,n) for(ll i=p;i<n;i++)
#define fr1(i,p,n) for(ll i=p;i>=n;i--)
#define pb push_back
#include <stdio.h>
#define PI 3.14159265358979323846
#define MOD 1000000007
#define precise cout << std::setprecision(10) << std::fixed;
using namespace std;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        ll h[n+1];
        ll dp[n+1];
        fr(i,1,n+1) {cin>>h[i];dp[i]=INT_MAX;}
        dp[1]=0;
        fr(i,1,n+1)
        {
            fr(j,1,k+1)
            {
                if((i+j)<=n)
                {
                    dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
                }
            }
        }
        cout<<dp[n]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
char s[1<<20],t[1<<20];
int main(){
	scanf(" %s",s+1);
	int n=strlen(s+1);
	strcpy(t+1,s+1);
	reverse(t+1,t+1+n);
	if(!strcmp(s+1,t+1)){
		n=(n-1)/2;
		strncpy(s+1,t+1,n);
		reverse(t+1,t+1+n);
		if(!strncmp(s+1,t+1,n)){puts("Yes");exit(0);}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> s(n);
    int sumx = 0;
    FOR(i, 0, n) {
        cin >> s[i];
        sumx += s[i];
    }
    if (sumx % 10)
        cout << sumx << endl;
    else {
        sort(s.begin(), s.end());
        int i = 0;
        while (i < n && s[i] % 10 == 0)
            i++;
        if (i == n)
            cout << 0 << endl;
        else
            cout << sumx - s[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input()) - 1 # 配列に対応
index = 0
trials = -1
for i in range(N):
    index = A[index]
    if index == 1:
        trials = i + 1
        break
print(trials)


Measured memory_bytes: 12852
#include<stdio.h>
#include<stdlib.h>

#define N 100
#define Gard 1000000000

int main(){
  int loop,result;
  int l,i,j,k;
  int Matrix[N];
  int Hairetu[N][N];
  
  scanf("%d",&loop);
  for(i=0;i<loop;i++){
    scanf("%d %d",&Matrix[i],&Matrix[i+1]);
  }

  for(i=1;i<=loop;i++){
    Hairetu[i][i]=0;
  }

  for(l=2;l<=loop;l++){
    
    for(i=1;i<=loop-l+1;i++){
      
      j=i+l-1;
      Hairetu[i][j]=Gard;
      
      for(k=i;k<=j-1;k++){
	result=Hairetu[i][k]+Hairetu[k+1][j]+Matrix[i-1]*Matrix[k]*Matrix[j];

	if(Hairetu[i][j]>result){
	  Hairetu[i][j]=result;
	}


	else{
	  Hairetu[i][j]=Hairetu[i][j];
	}
      }
    }
      
  }

  printf("%d\n",Hairetu[1][loop]);
  
 
  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll N,K;
  int trees[100005];
  ll mini=1145141919;
  ll a=mini;
  cin>>N>>K;
  for(ll i=0;i<N;i++) cin>>trees[i];
  sort(trees,trees+N);
  K--;
  for(ll i=0;i<N;i++){
    if(i+K==N) break;
    if(mini>trees[i+K]-trees[i]) mini=trees[i+K]-trees[i];
  }
  cout<<mini<<endl;
}


Measured memory_bytes: 640
s = input()
def checkEasy(s):
  for i in range(len(s)):
    if (i%2 == 0):
      if (s[i] == 'L'):
        return False
    else:
      if (s[i] == 'R'):
        return False
  return True
if (checkEasy(s)):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
    int i, ans = 0;
    char input[7];

    fgets(input, 7, stdin);

    for(i = 0; i < 6; i++){
        if(input[i] == '1'){
            ans++;
        }
    }

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


Measured memory_bytes: 128
use proconio::input;

fn main() {
    input!(n: usize, s: proconio::marker::Chars);
    let mut now = s.iter().copied().skip(1).filter(|&c| c == 'E').count();
    let mut ans = now;
    for i in 1..n {
        if s[i] == 'E' {
            now -= 1;
        }
        if s[i - 1] == 'W' {
            now += 1;
        }
        if now < ans {
            ans = now;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    while(n > 0){
        int x = n%10;
        if(x == 7){
            cout << "Yes"<<endl;
            return 0;
        }
        n = n/10;
    }
    cout << "No" << endl;

}


Measured memory_bytes: 3620
N, X, Y = map(int, input().split())

M = (Y-X)//2

d = [0] * (N-1)

for i in range(1, N):
    for j in range(i+1, N+1):
        dist = min([j-i, abs(X-i) + 1 + abs(j-Y), abs(Y-i)+1+abs(j-X)])

        d[dist-1] += 1

for s in d:
    print(s)


Measured memory_bytes: 46684
f=lambda:list(map(int,input().split()))
n,m=f();l=f();t=n
for b,c in sorted([f() for _ in range(m)],key=lambda k:-k[1]):
  l+=[c]*b;t+=b 
  if t>n*2:break
l.sort()
print(sum(l[-n:]))

Measured memory_bytes: 36856
N = int(input())
X = list(map(int, input().split()))

minx = min(X)
maxx = max(X)
min_cost = float('inf')
for p in range(minx, maxx + 1):
  cost = 0
  for xi in X:
    cost += (p - xi) * (p - xi)
  if cost < min_cost:
    min_cost = cost

print(min_cost)


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

int main()
{
    int n;
    string s;

    cin>>n;

    cin>>s;

    if(n%2!=0) {
        cout<<"No"<<endl;
    }else{
    string s2=string(s.begin(),s.begin()+(n/2));
    string s3=string(s.begin()+(n/2),s.end());

    if(s2.compare(s3)==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    }



    return 0;
}


Measured memory_bytes: 256
int main(void)
{
	int a;			/* ??\?????? */
	int b;			/* ??\?????? */
	int c;			/* ??\?????? */
	int tmp;		/* ????\???¨ */
	
	/* input */
	scanf("%d %d %d", &a, &b, &c);
	
	/* process	*/
	
	/* output */
	if( (a < b ) && ( b < c )){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	
	return 0;
}

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

import sys
import os
import math


N = int(input())
alphabet = 'abcdefghijklmnopqrstuvwxyz'

def encode(s, alpha, beta):
    t = []
    for c in s:
        if c == ' ':
            t.append(c)
        else:
            gamma = ord(c) - 97
            v = (alpha * gamma + beta) % 26
            w = alphabet[v]
            t.append(w)
    return ''.join(t)


for i in range(N):
    s = input().strip()

    for a in range(26):
        for b in range(26):
            encoded = encode(s, a, b)
            if 'that' in encoded or 'this' in encoded:
                print(encoded)

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

int main() {
    int a, b, ans = 0;
    cin >> a >> b;

    for (int i = 1; i <= (b - a); i++) {
        ans += i;
    }

    ans -= b;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <tuple>
using namespace std;

#include <sys/mman.h>
static char *_in_buf = 
(char*)mmap(NULL, 1 << 26, PROT_READ, MAP_PRIVATE, fileno(stdin), 0);
inline int read() {
  int p = 0, v = 0;
  while (*_in_buf < 48) (*_in_buf ++ == 45) && (v = 1);
  while (*_in_buf > 47 && *_in_buf < 58) p = p * 10 + *_in_buf ++ - 48;
  return v ? -p : p;
}

int n, q, ans[100005], dis[100005];
vector <tuple <int, int, int> > g[100005];

int par[100005], sz[100005];
int son[100005], dep[100005];
int ind[100005], top[100005], indx;
void dfs1(int u, int parent, int depth) {
  dep[u] = depth, par[u] = parent, sz[u] = 1;
  for (int i = 0; i < (int)g[u].size(); ++ i) {
    int v = get <0> (g[u][i]);
    if (v == parent) continue;
    dfs1(v, u, depth + 1), sz[u] += sz[v];
    if (sz[v] > sz[son[u]]) son[u] = v;
  }
}
void dfs2(int u, int topv) {
  top[u] = topv, ind[u] = ++ indx;
  if (son[u]) dfs2(son[u], topv);
  for (int i = 0; i < (int)g[u].size(); ++ i) {
    int v = get <0> (g[u][i]);
    if (v == par[u] || v == son[u]) continue;
    dfs2(v, v);
  }
}
inline int get_lca(int u, int v) {
  while (top[u] != top[v]) {
    if (dep[top[u]] < dep[top[v]])
      swap(u, v);
    u = par[top[u]];
  }
  if (dep[u] < dep[v]) return u;
  return v;
}

int dist[100005];
void dfs3(int u, int parent) {
  for (int i = 0; i < (int)g[u].size(); ++ i) {
    int v = get <0>(g[u][i]), w = get <2>(g[u][i]);
    if (v == parent) continue;
    dist[v] = dist[u] + w, dfs3(v, u);
  }
}

vector <tuple <int, int, int> > qry[100005];
int d[100005], cnt[100005];
void dfs4(int u, int parent) {
  for (int i = 0; i < (int)g[u].size(); ++ i) {
    int v = get <0>(g[u][i]), c = get <1> (g[u][i]), w = get <2>(g[u][i]);
    if (v == parent) continue;
    d[c] += w, cnt[c] ++;
    dfs4(v, u);
    d[c] -= w, cnt[c] --;
  }
  for (int i = 0; i < (int)qry[u].size(); ++ i) {
    int id = get <0>(qry[u][i]), c = get <1>(qry[u][i]);
    int t = get <2>(qry[u][i]), nowd = dis[id];
    int x = d[c], y = nowd * cnt[c];
    ans[id] += (y - x) * t;
  }
}

int main() {
  n = read(), q = read();
  for (int i = 1; i < n; ++ i) {
    int u = read(), v = read();
    int c = read(), d = read();
    g[u].emplace_back(v, c, d);
    g[v].emplace_back(u, c, d);
  }
  dfs1(1, 0, 1);
  dfs2(1, 1);
  dfs3(1, 0);
  for (int i = 1; i <= q; ++ i) {
    int c = read(); dis[i] = read();
    int u = read(), v = read();
    int lca = get_lca(u, v);
    ans[i] = dist[u] + dist[v] - 2 * dist[lca];
    qry[u].emplace_back(i, c, 1);
    qry[v].emplace_back(i, c, 1);
    qry[lca].emplace_back(i, c, -2);
  }
  dfs4(1, 0);
  for (int i = 1; i <= q; ++ i)
    printf("%d\n", ans[i]);
  return 0;
}

Measured memory_bytes: 25272
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    vector<map<char, ll>> cnt(n);

    // 各文字列に含まれる文字の数をそれぞれカウント
    rep(i, n){
        string s; cin >> s;
        rep(j, s.size()) cnt[i][s[j]]++;
    }

    // カウントをもとに辞書順最小の文字列を生成
    for(ll i='a'; i<='z'; i++){
        ll minv = INFLL;
        for(ll j=0; j<n; j++) chmin(minv, cnt[j][i]);
        cout << string(minv, i);
    }
    cout << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  ll n;
  cin>>n;
  n=n%10;
  if(n==2||n== 4||n== 5|| n==7|| n==9)
    cout<<"hon";
  else if(n==3)
    cout<<"bon";
  else
    cout<<"pon";
  
  return 0;
}

Measured memory_bytes: 3628
/*
*/

//#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600031;

long long n,a[N],b[N],sa,sb;

long long forced;

int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
//	cin.tie(0);

	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		sa+=a[i];
	}
	for (int i=1;i<=n;i++){
		cin>>b[i];
		sb+=b[i];
	}

	long long total_moves=sb-sa;
	if (total_moves<0){
		cout<<"No"<<endl;
		return 0;
	}

	long long sum_of_b_to_increase=0;
	for (int i=1;i<=n;i++){
		if (b[i]<a[i]){
			forced+=a[i]-b[i];
		}
		else if (b[i]%2!=a[i]%2)
			forced++;
	}

	if (forced>total_moves){
		cout<<"No"<<endl;
	}
	else
	{
		cout<<"Yes"<<endl;
	}

//	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 2432
import heapq

x,y,a,b,c=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
arr3=list(map(int,input().split()))
q=[]
for val in arr1:
  heapq.heappush(q,(-val,1))
for val in arr2:
  heapq.heappush(q,(-val,2))
for val in arr3:
  heapq.heappush(q,(-val,3))
ans=0
cnt1=0
cnt2=0
cnt3=0
while cnt1+cnt2+cnt3<x+y:
  tmp,flag=heapq.heappop(q)
  tmp*=-1
  if flag==1:
    if cnt1<x:
      ans+=tmp
      cnt1+=1
  elif flag==2:
    if cnt2<y:
      ans+=tmp
      cnt2+=1
  elif flag==3:
    ans+=tmp
    cnt3+=1
print(ans)

Measured memory_bytes: 48816
code = """

# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False


cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil:
    cdef cppclass fenwick_tree[T]:
        fenwick_tree(int n)
        void add(int p, T x)
        T sum(int l, int r)

cdef class FenwickTree:
    cdef fenwick_tree[long long] *_thisptr
    def __cinit__(self, int n):
        self._thisptr = new fenwick_tree[long long](n)
    cpdef void add(self, int p, long long x):
        self._thisptr.add(p, x)
    cpdef long long sum(self, int l, int r):
        return self._thisptr.sum(l, r)
"""


import os,sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('atcoder.pyx','w').write(code)
    os.system('cythonize -i -3 -b atcoder.pyx')


from atcoder import FenwickTree

N,Q = list(map(int,input().split()))
A = list(map(int,input().split()))
fw = FenwickTree(N)
for i, a in enumerate(A):
    fw.add(i,a)

for i in range(Q):
    a,b,c = list(map(int,input().split()))
    if a==0:
        fw.add(b,c)
    else:
        print(fw.sum(b,c))

Measured memory_bytes: 70052
X, Y = map(int, input().split())

MOD = 10**9+7

# コピペ

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range(2, 10**6+1):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD//i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

def combi_mod(n, r):
    if (r<0 or r>n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % MOD

# ====

sum_num = 0
for n in range(X+1):
    x, y = 1*n, 2*n
    xr, yr = X-x, Y-y
    if xr == yr*2:
        m = yr
        sum_num = (sum_num + combi_mod(n+m, m)) % MOD

print(sum_num)


Measured memory_bytes: 127940
n, q = map(int, input().strip().split(' '))
s = input()
ac = []
kazu = 0
for i in range(n-1):
    if s[i:i+2] == 'AC':
        kazu = kazu + 1
        ac.append(kazu)
    else:
        ac.append(kazu)
ac.append(0)
for i in range(q):
    num = 0
    l, r = map(int, input().strip().split(' '))
    print(ac[r-2]-ac[l-2])

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

const int MAX_N = 200010;
int A[MAX_N];
int K, N;

int main()
{
    scanf("%d %d", &K, &N);
    for(int i = 0; i < N; ++i) {
        scanf("%d", &A[i]);
    }
    A[N] = K + A[0];
    int mx = 0;
    for(int i = 0; i <= N; ++i) mx = max(mx, A[i+1] - A[i]);
    printf("%d\n", K - mx);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
  int N;
  int Y=0;
  string S;
  cin >> N;
  for (int i=0;i<N;i++)
  {
    cin >> S;
    if (S=="Y")
      Y = 1;
  }

  if ( Y == 1)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
}


Measured memory_bytes: 256
from math import log10
n, k = map(int, input().split())
a = list(map(int, input().split()))
MOD = 10**9+7
a.sort()

cnt_neg = 0
cnt_pos = 0
for i in a:
   if i <= 0:
      cnt_neg += 1
   else:
      cnt_pos += 1
is_minus = False
k_tmp = k
while k_tmp > 0:
   if k_tmp >= 2:
      if cnt_neg >= 2:
         cnt_neg -= 2
      elif cnt_pos >= 2:
         cnt_pos -= 2
      else:
         is_minus = True
         break
      k_tmp -= 2
   else:
      if cnt_pos > 0:
         cnt_pos -= 1
         k_tmp -= 1
      else:
         is_minus = True
         break

k_1 = k
ans1 = 1
l = 0
r = n - 1
if k_1 % 2:
   ans1 *= a[-1]
   r -= 1
   k_1 -= 1
while k_1 >= 2:
   if a[l] * a[l+1] > a[r-1] * a[r]:
      ans1 *= a[l] * a[l+1]
      l += 2
   else:
      ans1 *= a[r-1] * a[r]
      r -= 2
   k_1 -= 2
   ans1 %= MOD

a.sort(key=abs)
# print(a)
ans2 = 1
for i in a[:k]:
   ans2 *= i
   ans2 %= MOD

if is_minus:
   print(ans2)
else:
   print(ans1)

Measured memory_bytes: 102600
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<algorithm>
#include <iostream>
using namespace std;
typedef long long LL;
const  LL MAXN = 1e9+7;
int main(){
	int n;
	LL ans = 1;
	scanf("%d",&n);
	for(int i =1; i <= n; i++){
		ans *= i;
		ans %= MAXN;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
using namespace std;
typedef pair<int,int> PII;
int n;
int pos[400050],rnk[400050];
vector<PII> an;
int main()
{
	scanf("%d",&n);
	int k=0;
	while((1<<k)<n)
	{
		++k;
	}
	if(n==(1<<k))
	{
		printf("No\n");
		return 0;
	}
	pos[1]=1;
	an.push_back(make_pair(n+1,3));
	for(int i=1;i<k;++i)
	{
		int m=1<<i;
		an.push_back(make_pair(1<<(i-1),m));
		an.push_back(make_pair(m+n,m+1+n)); 
		for(int j=1;j<m;++j)
		{
			rnk[pos[j]]=j;
		}
		for(int j=1;j<m&&j+m<=n;++j)
		{
			an.push_back(make_pair(m+j+n,rnk[j]));
			an.push_back(make_pair(m+j,m));
			pos[j+m]=j;
			pos[j]=pos[j]+m; 
		}
		pos[m]=m;
	}
	printf("Yes\n");
	for(unsigned int i=0;i<an.size();++i)
	{
		printf("%d %d\n",an[i].first,an[i].second);
	}
	return 0;
} 

Measured memory_bytes: 4976
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  string v="";
  while(n){
    if(n%26==0){
      n/=26;
      n--;
      v+='z';
    }
    else{
      ll r=n%26;
      n=n/26;
      v+=('a'+r-1);
    }
  }
  reverse(v.begin(),v.end());
  cout<<v;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod  = 1e9 + 7;
const ll N = 3e3 + 5;

ll f[N]={0,0,0,1,1},n;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    if(n>4) for(int i=5;i<=n;i++) f[i]=(f[i-1]+f[i-3])%mod;
    cout<<f[n];
    return 0;
}

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

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

	int A;
	int B;
	cin >> A >> B;

	int i = 0; // nb taps
	for (i = 0; i < 20; ++i) {
		const int currentNbPlugs = 1 + i*(A - 1);
		if (currentNbPlugs >= B) break;
	}

	std::cout << i << std::endl;

	return 0;
}

Measured memory_bytes: 256
def main():
    x = int(input())

    t = 1
    while t * (t + 1) < x * 2:
        t += 1
    print(t)

    # [1,t]総和がXを超えるとき
    # 超過分に相当する距離のジャンプが区間に含まれる


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using plglg = pair<ll, ll>;
using tlglglg = tuple<ll, ll, ll>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    ll n; cin >> n;
    vll a(n); REP(i, n) cin >> a[i];

    vll times(n+1, 0);
    DEP(i, n-1) {
        times[i] = (times[i+1] + a[i]) % MOD;
    }

    ll ans = 0;
    REP(i, n-1) {
        ans = (ans + (a[i] * times[i+1])) % MOD;
    }
    print(ans);

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 6364
char s[1<<20];m[1<<20],n,t;main(){for(gets(s);s[n];m[++n]=--t)for(;t&&s[~t]-s[n];t=m[~t]);t-=~n;n=!printf(t*2<n?"Love %.*s!\n":"mitomerarenaiWA\n",t*=n/3/t+1,s);}

Measured memory_bytes: 5616
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int n = S.length()-2;
    System.out.println(S.substring(0,1)+String.valueOf(n)+S.substring(n+1,n+2));
  }
  

  
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>

using namespace std;

int main(){
    int x;
    int y;
    cin >> x >> y;
    string result = "No";
    for(int i = 0; i <= x; i++){
        int a = x - i;
        if(i * 2 + a * 4 == y){
            result = "Yes";
            break;
        }
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int MOD = 1000000007;

vector<vector<int>> to;
int N,M;
bool isPossible = false;
void dfs(int vertex=0, int count=0){
    if (count == 2){
        if (vertex == N-1){
            isPossible = true;
        }
        return;
    }
    for(auto next_vertex : to[vertex]){
        dfs(next_vertex, count+1);
    }
}


int main(){
    cin >> N >> M;
    to.assign(N,vector<int>());
    rep(i,M){
        int a, b; cin >> a >> b;
        a--;
        b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    dfs();
    
    if (isPossible) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;

}

Measured memory_bytes: 15064
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9+5;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,ans=0,cnt,y;
  cin >> n;
  for(ll i=2; i*i<=n; i++) {
    if(n%i==0) {
      cnt=0;
      while(n%i==0) {
        n/=i;
        cnt++;
      }
      y=1;
      for(int i=1; i<=cnt; i++) {
        ans++;
        cnt-=i;
      }
    }
  }
  if(n>1) {
    ans++;
  }
  cout << ans << endl;
}

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

int main()
{
	int takaA, takaB, aoA, aoB;
	cin >> takaA >> takaB >> aoA >> aoB;

	bool which=true;
	string ans;
	while (true)
	{
		if (which)
		{
			aoA -= takaB;
			which = false;
			if (aoA <= 0)
			{
				ans = "Yes";
				break;
			}
		}
		else
		{
			takaA -= aoB;
			which = true;
			if (takaA <= 0)
			{
				ans = "No";
				break;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main()

{

int n,max=-1,sum=0,p,i,j;
int m[1000];

scanf("%d ",&n);

for(i=0;i<n;i++)
{
scanf("%d",&m[i]);
}
for(i=0;i<n;i++)
{
if(m[i]>max)
{
max=m[i];
}
}


for(j=0;j<n;j++)

{
sum=sum+m[j];

}


 p=sum-max;

if(p>max)
{
printf("Yes\n") ;
}
else
printf("No\n");


return 0;
}   

Measured memory_bytes: 1664
import itertools
import decimal
import math
from collections import Counter
import sys
input = sys.stdin.readline

N=int(input())
ListA=list(map(int,input().split()))

master=0
for i in range(N):
    master=master^ListA[i]
    #print(bin(ListA[i])) 

#print(bin(master) 

for i in range(N):
    print(master^ListA[i],end=" ")


Measured memory_bytes: 32368
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }


int main() {
	int n;
	bool ans = false;
	cin >> n;
	rep(i, 25) {
		rep(j, 15) {
			if (i * 4 + j * 7 == n)ans = true;
		}
	}
	cout << (ans?"Yes":"No") << endl;
}


Measured memory_bytes: 384