akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
import itertools
INF = 10**10
MOD = 10**9+7

class UnionFind:

    def __init__(self, n):
        self.n = n
        self.par = [i for i in range(n)]
        self.height = [0] * n
        self.size = [1] * n

    def find(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def getsize(self, x):
        return self.size[self.find(x)]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if self.height[x] < self.height[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
        else:
            self.par[y] = self.par[x]
            self.size[x] += self.size[y]
            if self.height[x] == self.height[x]:
                self.height[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

def slide_min(a, k):
    n = len(a)
    b = [None] * (n-k+1)
    deq = deque()
    for i in range(n):
        while len(deq) > 0 and a[i] <= a[deq[-1]]:
            deq.pop()
        deq.append(i)
        if i-k+1 >= 0:
            b[i-k+1] = a[deq[0]]
            if deq[0] == i-k+1:
                deq.popleft()
    return b

def slide_max(a, k):
    n = len(a)
    b = [None] * (n-k+1)
    deq = deque()
    for i in range(n):
        while len(deq) > 0 and a[i] >= a[deq[-1]]:
            deq.pop()
        deq.append(i)
        if i-k+1 >= 0:
            b[i-k+1] = a[deq[0]]
            if deq[0] == i-k+1:
                deq.popleft()
    return b

N, K = map(int, input().split())
P = [int(x) for x in input().split()]
uf1 = UnionFind(N)
for i in range(N-1):
    if P[i] < P[i+1]:
        uf1.unite(i, i+1)
vs = []
for i in range(N-K+1):
    if uf1.same(i, i+K-1):
        vs.append(i)
uf2 = UnionFind(N)
if len(vs) > 1:
    for v1, v2 in zip(vs, vs[1:]):
        uf2.unite(v1, v2)
m, M = slide_min(P, K), slide_max(P, K)
for i in range(N-K):
    if P[i] == m[i] and P[i+K] == M[i+1]:
        uf2.unite(i, i+1)
s = set()
for i in range(N-K+1):
    s.add(uf2.find(i))
print(len(s))


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

int main() {
  int tmp = 1, a = 0, b = 0;
  string s;
  cin >> s;
  rep(i, s.size()){
    if(s[i] == '0') ++a;
    else ++b;
  }
  cout << min(a, b) * 2 << endl;
  return 0;
}

Measured memory_bytes: 512
package main

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

func main() {
	var n,m int
	fmt.Scan(&n)
	group := make([]int, n)
	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = []int{}
		group[i] = -1
	}
	
	fmt.Scan(&m)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < m; i++ {
		sc.Scan()
		s, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		t, _ := strconv.Atoi(sc.Text())
		
		g[s] = append(g[s], t)
		g[t] = append(g[t], s)
	}
	for i := 0; i < n; i++ {
		if group[i] != -1 {
			continue
		}
		q := []int{i}
		for len(q) > 0 {
			pop := q[0]
			if len(q) > 1 {
				q = q[1:]
			} else {
				q = []int{}
			}
			if group[pop] == -1 {
				q = append(q, g[pop]...)
				group[pop] = i
			}
		}
	}
	sc.Scan()
	q, _ := strconv.Atoi(sc.Text())
	for i := 0; i < q; i++ {
		sc.Scan()
		s, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		t, _ := strconv.Atoi(sc.Text())

		if group[s] == group[t] {
			fmt.Println("yes")
		} else {
			fmt.Println("no")
		}
	}
}

func root(i int, group *[]int) int {
	if i == (*group)[i] {
		return i
	}
	(*group)[i] = root((*group)[i], group)
	return (*group)[i]
}



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

using namespace std;

#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
#define fie(i,a,b) for(i=a;i<b;i++)
#define MOD 1000000007
#define mod 998244353
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ll long long
#define lld long long int
#define ALL(x) (x).begin(),(x).end()

typedef vector<lld> vi;
typedef vector<vector<lld>> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pair<lld, lld>> vpi;
typedef long long LL;

const lld mxx = 1000000000000000;

lld pow(lld st) {
    return st * st * st * st * st;
}

int main() {
    fast;
    cin.tie(0);
/*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w" , stdout);
#endif*/
    lld x;
    cin >> x;
    lld a = 0, b = 0;
    lld st = 1;
    vector<lld> v;
    v.push_back(0);
    while (true) {
        lld f = pow(st);
        if (f > mxx) {
            break;
        }
        else {
            v.push_back(f);
        }
        st++;
    }
    bool flag = true;
    for (lld i = 0; i < (lld)v.size(); i++) {
        for (lld j = 0; j < (lld)v.size(); j++) {
            lld aa = (v[i]), bb = (v[j]);
            if (aa + bb == x) {
                a = i;
                b = j * -1;
                flag = false;
                break;
            }
            if (aa - bb == x) {
                a = i;
                b = j;
                flag = false;
                break;
            }
            if (bb - aa == x) {
                a = i * -1;
                b = j * -1;
                flag = false;
                break;
            }
            if (aa + bb == (x * (-1))) {
                a = i * -1;
                b = j ;
                flag = false;
                break;
            }
        }
        if (!flag) break;
    }

    cout << a << " " << b << endl;

}

Measured memory_bytes: 3672
#include <iostream>
#include <math.h>
using namespace std;

int main(){
	int x, y, s;
	while (1){
		cin >> x >> y >> s;
		if (x == 0 && y == 0 && s == 0) break;
		int max = 0;
		for (int i = 2; i <= s; i++){
			for (int j = 1; j < i; j++){
				int c = ceil((j*(100+x)/100) + ((i-j)*(100+x)/100));
				if (c == s){
					int newC = ceil((j*(100 + y) / 100) + ((i - j)*(100 + y) / 100));
					if (newC > max) max = newC;
				}
			}
		}
		cout << max << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
s = int(input())

def f(n):
    if n % 2:
        return 3*n + 1
    else:
        return n//2

a = [s]
m = 1
while True:
    m += 1
    t = f(a[-1])
    if t in a:
        print(m)
        exit()
    else:
        a.append(t)



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

using namespace std;

typedef long long ll;
typedef long double ld;
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)

const ll N = 123456;
const ll mod = 1e9 + 7;
const ld eps = 1e-5;

int a[N];
ll dp[444][444];
ll pre[N];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cout << fixed;

    int n;

    cin >> n;

    rep(i , 1 , n) cin >> a[i];

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

    rep(len , 2 , n) {
        rep(l , 1 , n) {
            if(l + len - 1 > n) break;

            int r = l + len -   1;

            dp[l][r] += dp[l + 1][r];

            rep(k , l , r - 1) {
                dp[l][r] = min(dp[l][r] , dp[l][k] + dp[k + 1][r]);
            }

            dp[l][r] += pre[r] - pre[l - 1];
        }
    }

    cout << dp[1][n] << endl;

    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
  #include "_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

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...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v) {
    for (auto &e : t) fill(e, v);
}
// auto v = make_vec<int>(h, w);
// fill(v, 0);  

signed main(){

  int n; cin >> n;
  auto v = make_vec<int>(2, 3);
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < 3; j++){
      cin >> v[i][j];
    } 
  }

  int N = n;
  for(int i = 0; i < 2; i++){
    vector<int> dp(N + 1);
    iota(dp.begin(), dp.end(), 0);  
    for(int j = 0; j < 3; j++){
      int add = v[i][j], cost = v[i^1][j];
      for(int k = 0; k + add <= N; k++){
        dp[k + add] = max(dp[k + add], dp[k] + cost);
      }
    }
    N = dp[N];
  }
  cout << N << endl;

  return 0;
}

Measured memory_bytes: 198376
def main():
    N = int(input())
    s = input()
    o_ = {"SS": "S", "WS": "W", "SW": "W", "WW": "S"}
    x_ = {"SS": "W", "WS": "S", "SW": "S", "WW": "W"}
    ok = False
    for ans in ["SW", "WS", "SS", "WW"]:
        for i in range(1, N):
            if s[i] == "o": # oの時
                ans += o_[ans[-2:]]
            else:           # xの時
                ans += x_[ans[-2:]]
    
        if ans[0] == ans[-1]:
            if s[0] == "o":
                if o_[ans[-2:]] == ans[1]:
                    ok = True
            else:
                if x_[ans[-2:]] == ans[1]:
                    ok = True
        if ok:
            print(ans[:-1])
            break
    if not ok:
        print(-1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3572
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        // 記号を格納
        String[] arr;
        arr = new String[4];

        // 文字列の取得
        String str = sc.nextLine();

        for (int i = 0; i < arr.length; i++) {
        	arr[i] = str.split("")[i];
        }

        // 結果を保持
        int result = 0;

        // 計算
        for (String item : arr) {
        	switch(item) {
        	case "+":
        		result++;
        		break;
        	case "-":
        		result--;
        		break;
        	}
        }

        System.out.println(result);

    }
}

Measured memory_bytes: 22100
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if( (a * b) % 2 == 0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}

	}
}

Measured memory_bytes: 23508
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    Node[] nodes = new Node[N];
    for (int i = 0; i < N; i++) nodes[i] = new Node(i);
    for (int i = 0; i < N - 1; i++) {
      int a = scanner.nextInt() - 1;
      int b = scanner.nextInt() - 1;
      nodes[a].edges.add(nodes[b]);
      nodes[b].edges.add(nodes[a]);
    }

    List<Node> path = dfs(N, null, nodes[0]);
    Collections.reverse(path);
    Node endBlack = path.get((path.size() - 1) / 2);
    Node endWhite = path.get((path.size() - 1) / 2 + 1);

    int countBlack = dfs2(null, nodes[0], endWhite);
    int countWhite = dfs2(null, nodes[N - 1], endBlack);

    if (countBlack > countWhite) {
      System.out.println("Fennec");
    } else {
      System.out.println("Snuke");
    }
  }

  private static List<Node> dfs(int N, Node from, Node node) {
    if (node.id == N - 1) {
      List<Node> path = new ArrayList<>();
      path.add(node);
      return path;
    }
    for (Node e : node.edges) {
      if (e != from) {
        List<Node> found = dfs(N, node, e);
        if (found != null) {
          found.add(node);
          return found;
        }
      }
    }
    return null;
  }

  private static int dfs2(Node from, Node node, Node end) {
    int count = 1;
    for (Node e : node.edges) {
      if (e != from && e != end) count += dfs2(node, e, end);
    }
    return count;
  }

  static class Node {
    final int id;
    List<Node> edges = new ArrayList<>();

    Node(int id) {
      this.id = id;
    }
  }
}


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

int
main(int argc, char **argv)
{
  int n;
  int k;
  int cnt = 0;

  scanf("%d %d", &n, &k);

  cnt = 1;
  n = n/k;
  
  while (n) {
    cnt++;
    n = n/k;
  }


  printf("%d\n", cnt);
}


Measured memory_bytes: 128
#include <stdio.h>
int main(int argc, char const* argv[])
{
    long long int distance;
    int count=0;
    int n;
    //int **za;
    long long int za[200000][2];
    int i;
    if(scanf("%d%lld",&n,&distance)!=2) return -1;
    if((distance>200000||distance<0)||(n<1||n>200000)) return 1;
    for(i=0;i<n;i++)
    {
        if(scanf("%lld%lld",&za[i][0],&za[i][1])!=2) return 2;
    }
    for(i=0;i<n;i++)
    {
        if((za[i][0]*za[i][0]+za[i][1]*za[i][1])<=distance*distance) count++;
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
using Pdi = pair<double, int>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    double L; cin >> L;
    vector<int> t(N), v(N);
    vector<double> ans(N, 0.0);
    REP(i, N) cin >> t[i] >> v[i];

    deque<Pdi> dq;
    double S = 0.0;
    int V = 0;
    REP(i, N){
        int L0 = L - v[i];
        while(V > L0){
            double t2 = dq.front().f;
            int v2 = dq.front().s;
            dq.pop_front();
            if(v2 > V - L0){
                v2 -= V - L0;
                S -= t2 * (V - L0);
                V = L0;
                dq.push_front(Pdi(t2, v2));
            }else{
                S -= t2 * v2;
                V -= v2;
            }
        }

        V += v[i];
        S += t[i] * v[i];
        double t0 = t[i];
        int v0 = v[i];
        while(SZ(dq) > 0 && dq.back().f > t0){
            double t1 = dq.back().f;
            int v1 = dq.back().s;
            dq.pop_back();
            t0 = (t0 * v0 + t1 * v1) / (v0 + v1);
            v0 = v0 + v1;
        }
        dq.push_back(Pdi(t0, v0));
        
        ans[i] = S / L;
    }

    Out(ans);

    return 0;
}


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

int main(){
  int n,m,k,l,r;
  int a,b,c, ans;
  string s;
  //map<char , int> M;M['0'] = 0;M['1']=1;M[]
  cin >> s;
  //for(int i = 0 ; i < n; i++){}
  if(s <= "2019/04/30"){ cout << "Heisei" << endl;}
  else cout << "TBD" << endl;
  //cout >> >> endl;
}


Measured memory_bytes: 256
import os
import heapq
import sys
import math
from collections import defaultdict
from io import BytesIO, IOBase
def main():
    
    #for _ in range(int(input())):
    n=input()
    el=n[-1]
    if el=="2" or el=="4" or el=="5" or el=="7" or el=="9":
        print("hon")
    elif el=="3":
        print("bon")
    else:
        print("pon")
        
    
       
                            
            
                        
                
                
            
                
            
        
       


BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()


Measured memory_bytes: 67564
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n = int(input())
    aa = LI()
    change = True
    ps = 0
    ans = 0
    cnt = [0] * n
    while change:
        change = False
        sumk = 0
        for i in range(n):
            aa[i] += ps
            a = aa[i]
            if a <= n - 1: continue
            change = True
            k = a // n
            aa[i] -= (n + 1) * k
            cnt[i] += k
            sumk += k
            ans += k
        # print(ps,sumk,ans,aa)
        ps = sumk
    print(ans)

main()


Measured memory_bytes: 3064
#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"

using namespace std;

const long long int MOD = 1000000007;


long long int N, M, K, H, W, L, R;

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

	vector<string>ans;
	cin >> N >> M;
	while (N) {
		vector<int>v(N + 1);
		vector<int>s(M);
		for (int i = 0; i < M; i++) {
			cin >> s[i];
		}
		for (int i = 1; i <= N; i++) {
			cin >> v[i];
		}
		vector<vector<int>>dp(N + 1, vector<int>(256, MOD));
		dp[0][128] = 0;
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 256; j++) {
				for (auto k : s) {
					int nx = min(255, max(j + k, 0));
					dp[i + 1][nx] = min(dp[i + 1][nx], dp[i][j] + abs(nx - v[i + 1])*abs(nx - v[i + 1]));
				}
			}
		}
		int ans = MOD;
		for (int i = 0; i < 256; i++) {
			ans = min(ans, dp[N][i]);
		}
		cout << ans << endl;
		cin >> N >> M;
	}
	return 0;
}


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

int main(){
	int64_t h, w;
	cin >> h >> w;
	if (h == 1 || w == 1) cout << 1 << endl;
	else if (h % 2 == 1 && w % 2 == 1) {
		int64_t a = ((h * w) / 2) + 1;
		cout << a << endl;
	}
	else {
		int64_t a = (h * w) / 2;
		cout << a << endl;
	}
}


Measured memory_bytes: 256
/**
 * @author karayuu
 */
fun main(args: Array<String>) {
  //読み込む
  val (a, b) = readLine()!!.split(" ").map { it.toInt() }
  /**
   * 問題文より,(a + b) / 2を出力すれば良いことがわかる.
   * 条件から,2で割ったときに余りが出ることはない.
   */
  println((a + b) / 2)
}


Measured memory_bytes: 31996
n = list(input())
d100 = int(n[0])
d10 = int(n[1])
d1 = int(n[2])

if d100 == 1:
    d100 = 9
elif d100 == 9:
    d100 =1

if d10 == 1:
    d10 = 9
elif d10 == 9:
    d10 = 1

if d1 == 1:
    d1 = 9
elif d1 == 9:
    d1 = 1

n = d100*100 + d10*10 + d1
print(n)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    string S;
    cin >> S;
    rep(i, 3){
        cout << S[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3632
import java.util.*;
import java.lang.Double;

public class Main {

    public static void main(String[] args) {
      Scanner reader=new Scanner(System.in);
      int  n=reader.nextInt();
      int  m=reader.nextInt();
      int h[]=new int [n];
      int i;
      for(i=0;i<n;i++)
      {
        h[i]=reader.nextInt();
      }
      boolean x[]=new boolean[n];
      Arrays.fill(x,true);

      for(i=0;i<m;i++)
      {
        int a=reader.nextInt()-1;
        int b=reader.nextInt()-1;
        if(h[a]>h[b])
        x[b]=false;
        if(h[a]<h[b])
        x[a]=false;
        if(h[a]==h[b])
        {
          x[a]=false;
          x[b]=false;
        }
      }
        int count=0;
        for(i=0;i<n;i++)
        {
          if(x[i]==true)count++;
        }

          System.out.println(count);


      }

    }

Measured memory_bytes: 58976
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.begin(), v.end(),[](int a, int b){return a > b;});
#define ALL(X) (X).begin(),(X).end()
#define INF 999999999
#define M_PI 3.14159265358979323846
#define MOD 1000000007

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll power(ll a, ll b){
    ll res=1;
    while(b>0){
        if(b&1) res = res*a % MOD;
        a = a*a % MOD;
        b = b >> 1;
    }
    return res;
}

int main()
{
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif

    int N;
    vector<ll> C;
    cin >> N;
    C = fetch_vec<ll>(N);
    VRSORT(C);
    int ans=0;
    FOR(i,0,N) ans = (ans + C[i]*(i+2)) % MOD;
    ans = ans*power(4,N-1) % MOD;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
 
int main() {
	int a, b, c, d, e, k;
	string ans;
	cin >> a >> b >> c >> d >> e >> k;
	if (e - a > k) {
		ans = ":(";
	}
	else {
		ans = "Yay!";
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
L=[0]
R=[0]
def gcd(x,y):
    if x==0:return y
    else:return gcd(y%x,x)
for i in range(n-1):
    L.append(gcd(L[i],a[i]))
    R.append(gcd(R[i],a[-1-i]))
MAX=0
for i in range(n):
    MAX=max(MAX,gcd(L[i],R[-1-i]))
print(MAX)


Measured memory_bytes: 14584
N = int(raw_input())

numbers = map(int, raw_input().split())

min_num = min(numbers)
max_num = max(numbers)
min_cost = None 


for result in xrange(min_num, max_num+1):
    cost = 0 
    for number in numbers:
        cost += (number - result)**2
    if min_cost:
        if min_cost >= cost:
            min_cost = cost 
    else:
        min_cost = cost
print min_cost


Measured memory_bytes: 2568
N = int(input())

def beki(n):
    return all(b == '0' for b in bin(n)[3:])

if beki(N):
    print('No')
else:
    print('Yes')
    print(1, 2)
    for i in range(2, N, 2):
        print(i, i+1)
        print(i+N, i+1+N)
        print(N+1, i+1)
        print(N+1, i+N)
    if N % 2 == 0:
        a = 2 ** (len(bin(N)[2:]) - 1)
        b = N ^ a ^ 1
        print(a+N, N)
        print(b, N*2)


Measured memory_bytes: 5780
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	int w, a, b;
	cin >> w >> a >> b;
	if (a < b) cout << max(b - (a + w), 0) << endl;
	else cout << max(a - (b + w), 0) << endl;
}

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

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);

  double n, d;
  cin >> n >> d;
  int f = 0;
  for(int i = 0;i<n;i++){
    double x,y;
    cin >> x >> y;
    double z = x*x + y*y;
    z = sqrt(z);
    if(z <= d)f++;
  }
  cout << f << endl;

  return 0;
}


Measured memory_bytes: 3864
import sys
import collections
import bisect


def main():
    n, x = map(int, input().split())
    a = sorted(list(map(int, input().split())))
    k = 0
    ans = 0
    for i in range(n):
        k += a[i]
        if k > x:
            print(ans)
            return
        ans += 1
    print(ans if sum(a) == x else ans - 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9328
#include <bits/stdc++.h>
#define INF 1001001001001001001
using namespace std;
typedef pair<int, int> P;
vector<int> SA, SB;
vector<long long> L, R;
int X, Y, Z, N;

void solve1() {
    priority_queue<long long, vector<long long>, greater<long long>> Q;
    for(int i=0; i<N; ++i) L[i] = -INF;
    long long sum = 0;

    for(int i=0; i<N; ++i) {
        Q.push(SA[i]);
        sum += SA[i];
        if(X < Q.size()) {
            sum -= Q.top();
            Q.pop();
        }
        if(X == Q.size()) L[i] = sum;
    }
}

void solve2() {
    priority_queue<long long, vector<long long>, greater<long long>> Q;
    for(int i=0; i<N; ++i) R[i] = -INF;
    long long sum = 0;

    for(int i=N-1; i>=0; --i) {
        Q.push(SB[i]);
        sum += SB[i];
        if(Y < Q.size()) {
            sum -= Q.top();
            Q.pop();
        }
        if(Y == Q.size()) R[i] = sum;
    }
}

int main() {
    cin >> X >> Y >> Z;
    N = X + Y + Z;
    vector<int> A(N), B(N), C(N);
    for(int i=0; i<N; ++i) cin >> A[i] >> B[i] >> C[i];

    long long res = 0;
    for(int i=0; i<N; ++i) {
        res += C[i];
        A[i] -= C[i];
        B[i] -= C[i];
    }

    vector<int> I(N);
    iota(begin(I), end(I), 0);
    sort(begin(I), end(I), [&](int i, int j){ return A[i] - B[i] > A[j] - B[j]; });
    SA.resize(N); SB.resize(N);
    for(int i=0; i<N; ++i) {
        SA[i] = A[I[i]];
        SB[i] = B[I[i]];
    }

    L.resize(N); R.resize(N);
    solve1();
    solve2();

    long long tmp = -INF;
    for(int i=X-1; i<N-Y; ++i) tmp = max(tmp, L[i] + R[i + 1]);

    cout << res + tmp << endl;
}

Measured memory_bytes: 5368
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
set<int> div(int n){
	set<int> s;
	for(int i=1;i*i<=n;i++) if(n % i == 0) s.insert(i), s.insert(n/i);
	return s;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    sort(be(a));
    if(a[n-1] - a[0] >= 2){
    	cout << "No" << endl;
    	return 0;
    }
    if(a[0] == a[n-1]){
    	for(auto& i: div(n)){
    		if(i == 1 && a[0] == n - 1){
    			cout << "Yes" << endl;
    			return 0;
    		}
    		if(n/i == a[0]){
    			cout << "Yes" << endl;
    			return 0;
    		}
    	}
    	cout << "No" << endl;
    	return 0;
    }
    int mi = a[0];
    int numi = lower_bound(be(a), mi + 1) - a.begin(), numa = n - numi;
    for(auto& i: div(numa)){
    	if(i == 1){
    		continue;
    	}else{
    		if(numi - 1 + numa / i == mi){
    			cout << "Yes" << endl;
    			return 0;
    		}
    	}
    }
    cout << "No" << endl;
    return 0;
}


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

#define N 1000000

int main(){
	bool prime[N+1];
	
	for(long i=2; i<=N; ++i) prime[i]=true;

	for(long i=2; i<=N; ++i){
		if(prime[i]){
			for(long j=2; i*j<=N; ++j) prime[i*j]=false;
		}
	}
	
	while(1){
		int n ,count=1;
		long ans=2;
		
		scanf(" %d", &n);
		if(n==0) break;

		for(long i=3; i<=N; i+=2){
			if(count==n) break;
			
			if(prime[i]){
				ans+=i;
				++count;
			}
		}	
	
		printf("%ld\n", ans);	
	}
	return 0;
}

Measured memory_bytes: 2164
/*input
20 3
0 5 15
*/

//sometimes it's the people who no one imagines anything of 
//who do the things that no one can imagine.

//code author: iamxlr8

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
#define all(c) c.begin(),c.end()
#define mod 1000000007
#define inf 1000000000000000001
#define F first
#define S second
#define dbg(x) cout << #x << " = " << x << '\n'
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

void solve()
{
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    ll ans=inf;
    for(ll i=0;i<k-1;i++)
    {
        ans=min(ans,max(a[i+1]-a[i],n-a[i+1]+a[i]));
    }
    ans=min(ans,max(a[k-1]-a[0],n-a[k-1]+a[0]));
    cout<<ans;
}

int main() 
{
    off;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3584
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int A = sc.nextInt();

      if(X<A){System.out.print(0);}
      else{System.out.print(10);}
      
      
      
      
      


      
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; string s; cin>>n>>s;
	int ret=0;
	for (int i=0; i<n; i++)
		if(s.substr(i,3)=="ABC")
			ret++;
	cout<<ret<<"\n";
	return 0;
}

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

template <typename T>
std::vector<T> prime(const T max) {
  std::vector<bool> sieve(max - 1, true);
  const auto lim = std::floor(std::sqrt(max));

  if (max < 2) {
    return {};
  }

  T var = 2;
  while (var <= lim) {
    for (T i = 2; i * var <= max; i++) {
      sieve[i * var - 2] = false;
    }
    do {
      var++;
    } while (!sieve[var - 2] && var <= lim);
  }

  std::vector<T> ans;
  ans.reserve(std::count(sieve.cbegin(), sieve.cend(), true));
  for (T i = 0; i < max - 1; i++) {
    if (sieve[i]) {
      ans.push_back(i + 2);
    }
  }

  return ans;
}


int main() {
  int64_t q;
  std::cin >> q;
  std::vector<int64_t> l(q), r(q);

  for (int64_t i = 0; i < q; i++) {
    std::cin >> l[i] >> r[i];
  }

  const auto r_max = *std::max_element(r.cbegin(), r.cend());
  const auto l_min = *std::min_element(l.cbegin(), l.cend());

  const auto p_tmp = prime(r_max);
  const std::set<int64_t> p(p_tmp.cbegin(), p_tmp.cend());

  std::vector<int64_t> c((r_max - l_min) / 2 + 1, 0);

  for (int64_t i = 0; i < c.size(); i++) {
    const auto n = l_min + 2 * i;
    if (p.find(n) != p.end() && p.find((n + 1) / 2) != p.end()) {
      c[i]++;
    }
  }
  for (int64_t i = 1; i < c.size(); i++) {
    c[i] += c[i - 1];
  }

  for (int64_t i = 0; i < q; i++) {
    if (l[i] == l_min) {
      std::cout << c[(r[i] - l_min) / 2] << std::endl;
    } else {
      std::cout << c[(r[i] - l_min) / 2]
        - c[(l[i] - l_min) / 2 - 1] << std::endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3072
#include <cstdio>
using namespace std;

int main(int argc, char** argv)
{
	int n, res = 0;
	scanf("%d", &n);
	for(int c=1; c<n; c++) // c: N - C
		for(int a=1; a*a<=c; a++) // a: A
			if(c % a == 0)
				res += (a * a == c)? 1: 2; // (A * A + C) or (A * B + C & B * A + C)
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 1736
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (ll i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define dump(x)  cout << #x << " = " << (x) << endl;

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

ll n,s,ans = INF;

bool check(ll x){
    ll sum = 0;
    ll temp = n;
    while(temp > 0){
        sum +=temp%x;
        temp /= x;
    }
    return sum==s;
}

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

    cin >> n >> s;
    if(s > n){
        cout << -1<<"\n";
        return 0;
    }
    if(s == n){
        cout << n+1 << "\n";
        return 0;
    }

    repd(k,1,sqrt(n-s)+5){
        if((n-s)%k == 0){
            ll b = (n - s)/k + 1;
            if(check(b)) {
                ans = min(ans,b);
                break;
            }
        }
    }

    rep(i,2,sqrt(n)+5){
        if(i > ans){
            break;
        }
        if(check(i)){
            ans = min(ans,i);
        }

    }

    if(ans == INF) cout <<-1 <<"\n";
    else cout << ans << "\n";
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)       for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int a, b, c; cin >> a >> b >> c;
    cout << (a + b + c >= 22 ? "bust" : "win") << endl;

return 0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
    int N, K;
    cin >> N >> K;

    vector<int> arr(N);
    map<int, int> m;
    multimap<int, int> m1;
    for (int i = 0; i < N; i++) {
        cin >> arr[i];
        m[arr[i]] += 1;
    }

    for (auto& p: m) {
        m1.emplace(p.second, p.first);
    }

    int kind = m.size() - K;
    if (kind < 0) {
        cout << 0 << endl;
    } else {
        int64_t ans = 0;
        int cnt = 0;
        for (auto& p: m1) {
            if (cnt == kind) break;
            ans += p.first; 
            cnt++;
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 19840
#include<bits/stdc++.h>
using namespace std;
 
int n;
string str;
int t[26];
map<int,int> mp;
int ans=-1;
 
int main(){
  cin>>n>>str;
  for(int i=0;i<n;i++){
    if(str[i]=='+')continue;
    t[ (int)(str[i]-'a') ]++;
  }
   
  for(int i=0;i<26;i++){
    if(t[i]==0)continue;
    if(t[i]==1){
      ans+=2;
    }else{
      mp[t[i]]++;
    }
  }
  map<int,int> :: iterator it;
  for(it=mp.begin();it!=mp.end();it++){
    if(it->second>=2)ans+=(2+it->second*2-1+2+1);
    else ans+=4;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

using namespace std;

bool binary_search(vector<int> v, int kay){
    int left = 0;
    int right = SZ(v);
    int mid;
    while(left < right){
        mid = (left + right)/2;
        if (v[mid] == kay) return true;
        else if (kay < v[mid]) right = mid;
        else left = mid+1; 
    }
    return false;
}

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

    int n;
    cin >> n;

    vector<int> v;
    int t;
    REP(_, n){cin >> t; v.PB(t);}

    cin >> n;
    int count = 0;
    REP(_, n){
        cin >> t;
        if (binary_search(v, t)) count++;
    }

    cout << count << endl;
}


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

int main(){
  int n, x, sum = 0, ans = 1;
  cin >> n >> x;
  vector<int> l(n);
  rep(i, n, 0){
    cin >> l.at(i);
    sum += l.at(i);
    if(sum <= x) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
int main() {
  int N, M;
  cin >> N >> M;
  printf(N == M ? "Yes\n" : "No\n");
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
 
#define pb push_back 
#define x first 
#define y second 
#define MOD 1000081
 
using namespace std;
typedef long long ll;
typedef pair< int , int > PII;

ll n, a[100100];

bool ch(ll x){
	for (int i = 1; i <= n; i++){
		x = (x / a[i]) * a[i];
	}
	return (x >= 2);
}

bool ch2(ll x){
	for (int i = 1; i <= n; i++){
		x = (x / a[i]) * a[i];
	}
	return (x <= 2);
}

bool check(ll x){
	if (x == -1) return 0;
	for (int i = 1; i <= n; i++){
		x = (x / a[i]) * a[i];
	}
	return (x == 2);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
		
	ll st = 1, dr = 1e15, rs1 = -1;
	while (st <= dr){
		ll mid =(st + dr) >> 1;
		if (ch(mid)) rs1 = mid, dr = mid - 1;
		else st = mid + 1;
	}
        
    st = 1, dr = 1e15;
    ll rs2 = -1;
    while (st <= dr){
		ll mid = (st + dr) >> 1;
		if (ch2(mid)) rs2 = mid, st = mid + 1;
		else dr = mid - 1;
	}
    
    if (!check(rs1) || !check(rs2)) return cout << -1, 0;
    
    cout << rs1 << " " << rs2 << "\n";
    
    return 0;
}


Measured memory_bytes: 1152
# 間違いコード
x,k,d = map(int,input().split())
ans = 0

if x>0:
  if x-k*d > 0:
    ans = x-k*d
  else:
    if (k-(x//d))%2 == 0: #右
      ans = x-(x//d)*d    
    else:
      ans = abs(x-(x//d+1)*d)  
else:
  if x<0 and x+k*d < 0:
    ans = abs(x+k*d)
  else:
    if (k-(-x//d))%2 == 0: #左
      ans = abs(x + (-x//d)*d )
    else:
      ans = abs(x +(-x//d+1)*d )
print(ans)    


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

int main() { 
    char a, b;
    cin >> a >> b;

    if (a == 'H') {
        cout << b << endl;
    } else if (b == 'H') {
        cout << 'D' << endl;
    } else {
        cout << 'H' << endl;
    }
}

Measured memory_bytes: 256
import itertools

a = []
for i in range(3):
    aa = list(map(int,input().split()))
    a.append(aa)
a = list(itertools.chain.from_iterable(a))

b = []
n = int(input())
for i in range(n):
    x = int(input())
    if x in a:
        ii = a.index(x)
        b.append(ii)
c = [[0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [2,4,6]] 
flg = False
for i in range(8):
    ci, cj, ck = c[i][0], c[i][1], c[i][2]
    if ci in b and cj in b and ck in b:
        flg = True
        break
print('Yes') if flg else print('No')

Measured memory_bytes: 9164
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        a: i64,
        b: i64,
    }
    let mut i = std::i64::MIN;
    i = std::cmp::max(i, a + b);
    i = std::cmp::max(i, a - b);
    i = std::cmp::max(i, a * b);
    println!("{}", i);
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 2e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}



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


    string s, t;
    cin >> s >> t;
    cout << t+s;







    return 0;
}


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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

set<ll> enum_div(ll n)//nの約数を列挙
{
    set<ll> ret;
    for(ll i=1 ; i*i<=n ; ++i)
    {
        if(n%i == 0)
        {
            ret.insert(i);
            if(i!=1 && i*i!=n)
            {
                ret.insert(n/i);
            }
        }
    }
    // 自分も約数
    ret.insert(n);
    return ret;
}

void solve() {
    ll N,M;
    cin >> N >> M;
    // ans d
    // sum(a) >= N, M = d*x, Nd <= M (ちょうじり合わせで他の要素を足す場合があるので、以下になる。)
    // d,d,d,d.... , M-(d*(N-1))
    auto s = enum_div(M);
    ll ans = 1;
    for(const auto &it: s) {
        if(N * it <= M) chmax(ans,it);
    }
    cout << ans << endl;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3632