akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<algorithm>
    #include<string>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    using namespace std;
    #define INF 10000000;
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define rrep(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
    #define vec(n) vector<int>(n)
    #define vvec(m,n) vector<vector<int>> vec(m,vector(n))

  
  
    int main(){
      int n,a,b;
      cin >> n >> a >> b;
      int res = b-a;
      if(res%2 == 0)cout <<"Alice"<<endl;
      else cout <<"Borys"<<endl;
      }
    


Measured memory_bytes: 256
base = [1,6,9]
SISU = 6
seiyaku = ([1])
MAX = 999999999
for i in range(1, 7):
    seiyaku.append(pow(base[1], i))
    seiyaku.append(pow(base[2], i))
seiyaku.sort()
# print(seiyaku)

N = int(input())
count = 0
DP = [0,1]
for n in range(2, N+1):
    arr = []
    i = 0
    while n >= seiyaku[i]:
        arr.append(DP[n-seiyaku[i]] + 1)
        i += 1
    # print(n, i, arr)
    DP.append(min(arr))


print(DP[N])

Measured memory_bytes: 3856
/*                    */
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
char itoc(lint i) { return i + '0'; };
lint ctoi(char c) { return c - '0'; };
/*                    */

int main() {
  lint n;
  cin >> n;
  string s;
  char hoge;
  cin.get(hoge);
  vector<lint> cnt(3, 0);
  for (lint i = 0; i < n; i++) {
    char tmp;
    cin.get(tmp);
    s.push_back(tmp);
    if (tmp == 'R')
      cnt.at(0)++;
    else if (tmp == 'G')
      cnt.at(1)++;
    else if (tmp == 'B')
      cnt.at(2)++;
  }

  lint ans = cnt.at(0) * cnt.at(1) * cnt.at(2);
  for (lint d = 1; d <= (n - 1) / 2; d++) {
    for (lint i = 0; i < n - 2 * d; i++) {
      char a, b, c;
      a = s.at(i);
      b = s.at(i + d);
      c = s.at(i + 2 * d);
      if (a != b && b != c && c != a) ans--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace atcorder_BeginnerContest_126
{
    class Program
    {

        static void Main(string[] args)
        {

            int[] cntRow = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            int siCnt = cntRow[0];
            double maxScore = cntRow[1];
            double ret = 0.0;
            for (int i = 1; i <= siCnt; i++)
            {
                double tmpScore = i;
                double prob = 1.0 / siCnt;

                while (tmpScore < maxScore)
                {
                    prob *= 1.0 / 2;
                    tmpScore *= 2;
                }

                ret += prob;
            }


            Console.WriteLine(ret);

        }

    }
}



Measured memory_bytes: 11092
#include <iostream>
#include <stdio.h>
#include <vector>
#include <set>
#include <string.h>
using namespace std;

int main()
{
  int n = 0;
  scanf("%d", &n);
  vector<int> a(n, 0);
  for(int i=0; i<n; i++){
    scanf("%d", &a[i]);
  }
  long long arr[n][n];
  memset(arr, 0, sizeof arr);
  for(int i=0; i<n; i++){
    arr[i][i] = a[i];
  }
  for(int j=1; j<n; j++){
    for(int i=0; i<n-j; i++){
      arr[i][i+j] = max(a[i] - arr[i+1][i+j], a[i+j] - arr[i][i+j-1]);
    }
  }
  printf("%lld\n", arr[0][n-1]);
}


Measured memory_bytes: 74088
#include<iostream>
#include<iomanip>
using namespace std;
int main() {
	double a;
	double answer;
	while (cin >> a) {
		answer = a;
		for (int i = 2; i < 11; ++i) {
			answer+=(i % 2 ? a /= 3.0 : a *= 2.0);
		}
		cout <<setprecision(10)<< answer<<endl;
	}
	return 0;
}

Measured memory_bytes: 1276
N = int(input())
P = list(map(float,input().split()))

#dp[i][j]:コインiまでで表がj枚でる確率
dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
dp[1][1] = P[0]
dp[1][0] = 1 - P[0]
for i in range(2,N+1):
  for j in range(i+1):
    if j == 0:
      dp[i][j] = dp[i-1][0] * (1-P[i-1])
    elif j == i:
      dp[i][j] = dp[i-1][j-1] * P[i-1]
    else:
      dp[i][j] = dp[i-1][j] * (1-P[i-1]) + dp[i-1][j-1] * P[i-1]

ans = 0
for i in range(N//2+1,N+1):
  ans += dp[N][i]
print(ans)


Measured memory_bytes: 262792
import java.util.Scanner;

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

        String ring = s1 +s1;

        if(ring.contains(s2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


        scn.close();


    }



}


Measured memory_bytes: 26232
#include <iostream>

int main(int, char**) {
    int N;
    int *div;
    long long sum=1;
    std::cin>>N;
    div=new int[N+1];
    std::fill_n(div,N+1,0);
    for(int K=2;K<=N;++K){
        sum+=static_cast<long long>(div[K]+2)*K;
        for(int i=K<<1;i<=N;i+=K){
            div[i]++;
        }
    }
    std::cout<<sum<<"\n";
    delete[] div;
    return 0;
}


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

int gcd(int p, int q) {
	if (p < q) swap(p, q);
	if (p % q == 0) return q;
	else return gcd(p / q, p % q);
}
int keta(long p, int q) {
	if (p / 10 == 0) return q + 1;
	else return keta(p / 10, q + 1);
}
long long kaijo(int p, int q) {
	if (p == 1) return q;
	else return kaijo(p - 1, p * q);
}

int main() {
	using pll = pair<long long, long long>;
	int N, K;
	cin >> N >> K;
	vector<int> high(N);
	rep(i, N) cin >> high.at(i);
	sort(high.begin(), high.end());
	int ans = high.at(N - 1) - high.at(0);
	rep(i, N - K + 1) ans = min(high.at(N - 1 - i) - high.at(N - i - K), ans);
	cout << ans << endl;
}

Measured memory_bytes: 640
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_093_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP    PIC X(26).
    01 maxlen PIC 9(1)  VALUE 3.
    01 cur    PIC 9(26) VALUE 1.
    01 i      PIC 9(18) VALUE 1.
    01 j      PIC 9(18).

    01 m      PIC 9(11).
    01 p      PIC 9(11).

    01 len    PIC 9(26).
    01 ZS     PIC Z(11).
    01 ans    PIC X(10).
    01 ABK1.
        03 ABK11 OCCURS 3.
            05 ABK PIC 9(10).

    01 A1.
        03 A11  OCCURS 100.
            05 A PIC 9(10).
    01 B1.
        03 B11  OCCURS 100.
            05 B PIC 9(10).

    01 tmp    PIC 9(10).
    01 idx    PIC 9(10).
    01 idx2   PIC 9(10).

    01 DUMMY  PIC X(1).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.

    PERFORM maxlen TIMES

        PERFORM VARYING j FROM cur BY 1
            UNTIL INP(j:1) = SPACE
        END-PERFORM

        COMPUTE len = j - cur

        MOVE INP(cur:len) TO ABK(i)

        COMPUTE cur = j + 1

        ADD 1 TO i

    END-PERFORM.

    MOVE 1 TO idx.
    PERFORM VARYING m FROM ABK(1) BY 1 UNTIL ABK(1) + ABK(3) - 1 < m
        IF m <= ABK(2) THEN
            MOVE m TO A(idx)
            ADD 1 TO idx
        ELSE
            EXIT PERFORM
        END-IF
    END-PERFORM.

    MOVE 1 TO idx2.
    SUBTRACT 1 FROM idx GIVING tmp.

    PERFORM VARYING p FROM ABK(2) BY -1 UNTIL p < ABK(2) - ABK(3) + 1
        IF A(tmp) < p THEN
            MOVE p TO B(idx2)
            ADD 1 TO idx2
        ELSE
            EXIT PERFORM
        END-IF
    END-PERFORM.

    SUBTRACT 1 FROM idx.
    PERFORM VARYING m FROM 1 BY 1 UNTIL idx < m
        MOVE A(m) TO ZS
        PERFORM UNANS
        DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans))
    END-PERFORM.

    SUBTRACT 1 FROM idx2.
    PERFORM VARYING p FROM idx2 BY -1 UNTIL p < 1
        MOVE B(p) TO ZS
        PERFORM UNANS
        DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans))
    END-PERFORM.

    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


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

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

using namespace std;

const int MAX = 1010;
int cave[MAX][MAX];
int toIndex[1000010];
int dp[MAX][MAX];
int dx[] = {+1,+0,-1,+0};
int dy[] = {+0,-1,+0,+1};

bool isValid(int x,int y) { return 0 <= x && x < MAX && 0 <= y && y < MAX; }

void pre_calc(){
  memset(cave,-1,sizeof(cave));
  int phase = 1;
  int x = MAX/2, y = MAX/2, dir = 0;
  while( phase <= 1000000 ){
    toIndex[phase] = x + y * MAX;
    cave[y][x] = phase++;
    x += dx[dir], y += dy[dir];
    if( cave[y+dy[(dir+1)%4]][x+dx[(dir+1)%4]] == -1 ) ( dir += 1 ) %= 4;
  }
}

const int  MAX_P = 1000010;

bool isntprime[MAX_P+1]; 	
void init(){
  isntprime[0] = isntprime[1] = true;
  int j;	
  for(int i=2;i<= MAX_P;i++)if(!isntprime[i])for(j=2*i;j<=MAX_P;j+=i)isntprime[j] = true;
}


void compute(int limit,int sp){
  memset(dp,-1,sizeof(dp));
  int sx = toIndex[sp] % MAX, sy = toIndex[sp] / MAX;
  dp[sy][sx] = !isntprime[sp];
  int maxi[2] = {0,0};
  if( dp[sy][sx] > maxi[0] ) { maxi[0] = dp[sy][sx], maxi[1] = sp; }
  REP(y,sy,MAX) rep(x,MAX) if( dp[y][x] != -1) {
    for(int dx=-1;dx<=1;dx++){
      int nx = x + dx, ny = y + 1;
      if( !isValid(nx,ny) ) continue;
      if( cave[ny][nx] > limit || cave[ny][nx] == -1 ) continue;
      dp[ny][nx] = max(dp[ny][nx],dp[y][x]+!isntprime[cave[ny][nx]]);
      if( !isntprime[cave[ny][nx]] ) {
        if( dp[ny][nx] > maxi[0] ) { maxi[0] = dp[ny][nx]; maxi[1] = cave[ny][nx]; }
        else if( dp[ny][nx] == maxi[0] ) maxi[1] = max(maxi[1],cave[ny][nx]);
      }
    }
  }
  cout << maxi[0] << " " << maxi[1] << endl;
}

int main(){
  init();
  pre_calc();
  int m,n;
  while( cin >> m >> n, m,n ) compute(m,n);
  return 0;
}

Measured memory_bytes: 14020
import heapq
n,m= map(int,input().split())
pml = [[] for _ in range(8)]
for ll in pml:heapq.heapify(ll)
for _ in range(n):
    x,y,z= map(int,input().split())
    for xs in [1,-1]:
        for ys in [1,-1]:
            for zs in [1,-1]:
                tempid = (4 if xs==1 else 0) + (2 if ys==1 else 0) + (1 if zs==1 else 0)
                tempspm = x*xs + y*ys + z*zs
                heapq.heappush(pml[tempid],tempspm)
apml = [0]*8
for i in range(m):
    for xs in [1,-1]:
        for ys in [1,-1]:
            for zs in [1,-1]:
                tempid = (4 if xs==1 else 0) + (2 if ys==1 else 0) + (1 if zs==1 else 0)
                apml[tempid] += - heapq.heappop(pml[tempid])
print(max(apml))

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

int main() {
  int N;
  string S;
  
  cin >> N >> S;
  
  queue<int> Slimes;
  char q1 = S.at(0);
  Slimes.push(q1);
  
  for(int i = 1;i < N; i++){
    char q2 = S.at(i);
    
    if(q1 != q2){
      Slimes.push(q1);
      q1 = q2;
    }
  }
  
  cout << Slimes.size() << endl;
  return 0;
}

Measured memory_bytes: 768
N, M = map(int, input().split())
H = list(map(int, input().split()))


A_list = []
B_list = []
Remove_list = []

for _ in range(M):
  A, B = map(int, input().split())
  A_list.append(A - 1)
  B_list.append(B - 1)

for A, B in zip(A_list, B_list):
  A_height = H[A]
  B_height = H[B]
  
  if A_height <= B_height:
    Remove_list.append(A)
  
  if B_height <= A_height: 
    Remove_list.append(B)
  
S = set(range(N))
S = S - set(Remove_list)

print(len(S)) 
 

Measured memory_bytes: 123836
#![allow(unused)]

use std::io::{Read, StdinLock};
use std::iter::{FromIterator, Iterator};
use std::str::{FromStr};
use std::string::String;

macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

pub fn read_bytes<T: FromIterator<char>>(s: &mut StdinLock) -> T {
    s.bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<T>()
}

pub fn reads(s: &mut StdinLock) -> String {
    read_bytes::<String>(s)
}

pub fn read<T: FromStr>(s: &mut StdinLock) -> T {
    reads(s).parse().ok().unwrap()
}

//==============================================================================
//
// Problem specific code
//
//==============================================================================

fn main() {
    let sin = std::io::stdin();
    let mut sin = sin.lock();

    let s = read_bytes::<Vec<char>>(&mut sin);

    if s[2] == s[3] && s[4] == s[5] {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int M = Integer.parseInt(tokens[1]);
		int result = N * (N - 1) / 2;
		result += M * (M - 1) / 2;
		System.out.println(result);
	}

	void calc() {
	}

	void showResult() {
	}

}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll cnt = 0, sum = 0;
  for (ll i = 0; i < n; i++) {
    cin >> a.at(i);
    if (a.at(i) < 0) {
      cnt++;
      sum -= a.at(i);
    }
    else sum += a.at(i);
  }
  if (cnt % 2 == 0) cout << sum << endl;
  else {
    for (ll i = 0; i < n; i++)
      if (a.at(i) < 0) a.at(i) *= - 1;
    sort(a.begin(), a.end());
    cout << sum - 2 * a.at(0) << endl;
  }
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{

    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//----------------------------------------------------------------

int main()
{
    ll n;
    cin >> n;
    ll a;
    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        sum += a - 1;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
 //     freopen("q.gir","r",stdin);
 //     freopen("q.cik","w",stdout);
      int n,m;
      cin>>n>>m;
      string s;
      cin>>s;
      vector<int>path;
      reverse(all(s));
      if(s[0]=='1'){
            cout<<-1;
            return 0;
      }
      int ind=0;
      while(ind<n){
            int start=ind,fin=ind;
            while(ind<=n&&ind<=start+m){
                  if(s[ind]=='0')fin=ind;
                  ++ind;
            }
            if(start==fin){
                  cout<<-1;
                  return 0;
            }
            path.pb(fin-start);
            ind=fin;
      }
      reverse(all(path));
      for(int i=0;i<path.size();i++)cout<<path[i]<<" ";
}


Measured memory_bytes: 1480
N, L = map(int, input().split())
li = []
li2 = []

for i in range(1, N+1):
    li.append(i)

for i in range(1, N+1):
    li2.append(i + L - 1)

if li2[0] > 0:
    del li2[0]

if li2[-1] < 0:
    del li2[-1]

s = sum(li2)


print(s)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    string s;
    int w;
    cin >> s >> w;
    string ans = "";
    int ind = 0;
    while(ind < s.size()) {
        ans += s[ind];
        ind += w;
    }
    output(ans);
    
    return 0;
}


Measured memory_bytes: 256
def main():
  n, w = map(int, input().split())
  
  value = []
  weight = []
  num = []
  
  for _ in range(n):
    vi, wi, ni = map(int, input().split())
    value.append(vi)
    weight.append(wi)
    num.append(ni)
  
  def summary(x):
    acc = 1
    ret = [0]
    while x >= acc:
      ret.append(acc)
      x -= acc
      acc *= 2
    if x:
      ret.append(x)
    return ret
  
  num = list(map(summary, num))
  
  dp = [0 for _ in range(w + 1)]
  for i in range(n):
    vi = value[i]
    wi = weight[i]
    numsi = num[i]
    for k in numsi:
      wik = wi * k
      vik = vi * k
      for j in range(w, wik - 1, -1):
        pre = dp[j - wik] + vik
        if dp[j] < pre:
          dp[j] = pre
  
  print(dp[w])

main()


Measured memory_bytes: 5988
#include <stdio.h>

int N,M,X,A,i;
int *map;

int main() {
  
  scanf("%d %d %d", &N, &M, &X);
  map = new int[N];
  for(i = 0; i < N; ++i) {
    map[i] = 0;
  }

  for(i = 0; i < M; ++i) {
	scanf("%d ", &A);
    map[A] = 1;
  }
  
  for(i = X+1; i < N-1; ++i) {
    map[i+1] += map[i];
  }
  for(i = X-1; i > 0; --i) {
    map[i-1] += map[i];
  }
  printf("%d", (map[0] < map[N-1] ? map[0] : map[N-1]));
  
  delete[] map;
  
  return 0;
}

Measured memory_bytes: 256
from math import gcd
a = int(input())  # take amount of number
b = list(map(int, input().split()))  # take all number in an array. Also can be solved without array in c++
lcm = b[0]  # assign first element to lcm
for m in b[1:]:
    lcm = int((lcm*m)/gcd(lcm, m))  # check telegram tutorial to understand this
print(lcm)



Measured memory_bytes: 5664
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	string s;
	cin >> s;
	if (find(find(s.begin(), s.end(), 'C'), s.end(), 'F') == s.end()) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}


Measured memory_bytes: 256
n , m = map(int, input().split())
a = list(map(int,input().split()))

def gcd(num1,num2):
    r=1
    while r>0:
        r=num1%num2
        num1=num2
        num2=r
    return num1

def lcm(num1,num2):
    gcd1=gcd(num1,num2)
    return num1*num2//gcd1

lcm1=a[0]//2
lcm2=a[0]

for i in range(1,n):
    t=a[i]
    lcm1=lcm(lcm1,t//2)
    lcm2=lcm(lcm2,t)
    ta=max(t//2,lcm1)
    tb=min(t//2,lcm1)
    if ta!=tb and ta//tb%2==0:
        lcm1=0
        lcm2=0
        break

if lcm1!=0:
    ans1=m//lcm1
    ans2=m//lcm2
    ans=ans1-ans2
else:
    ans=0

print(ans)


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

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define REP(i, n) for(LL i = 0; i < n; ++i)
#define FOR(i, a, n) for(LL i = a; i < n; ++i)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

//#define int long long

/*************** using variables ***************/
int e;
int m = INF;
/**********************************************/

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

    while(cin >> e, e){
        m = INF;
        for(int z = 0; z*z*z <= e; z++){
            for(int y = 0; y*y <= e-z*z*z; y++){
                int x = e - y*y - z*z*z;
                if(x+y*y+z*z*z == e){
                    //cout << x << " " << y << " " << z << endl;
                    m = min(m, x+y+z);
                }
            }
        }

        cout << m << endl;
    }
}



Measured memory_bytes: 3080
import java.util.Scanner;
public class Main {
	static String tar;
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		tar = stdIn.next();
		int ans = 0;
		for(int i = 0; i < n; i++) {
			String tmp = stdIn.next();
			if(sorv(tmp)) {
				ans++;
			}
			
		}
		System.out.println(ans);
	}
	
	static boolean sorv(String a) {
		int pp = 0;
		int cp = 0;
		if(a.length() < 3) {
			return false;
			
		}
		
		while(true) { //1文字目
			if(pp == a.length()) {
				break;
				
			}
			if(a.charAt(pp) == tar.charAt(0)) {
				//2文字目の検索 文字間隔決定
				cp = 1;
				while(true) {
					if(pp+cp >= a.length()) {
						break;
					}
					if(a.charAt(pp+cp) == tar.charAt(1)) {
						//文字間隔cpで照合
						int np = 2;
						for(int i = pp+cp+cp; i < a.length(); i+= cp) {
							
							if(a.charAt(i) == tar.charAt(np)) {
								np++;
							}
							else {
								break;
							}
							if(np == tar.length()) {
								return true;
							}
						}
					}
					cp++;
				}
			}
			pp++;
			
		}
		return false;

	}
}

Measured memory_bytes: 20368
if __name__ == '__main__':

	n = int(input())
	A = list(map(int,input().split()))

	n2 = int(input())

	for i in range(n2):
		com,b,e = map(int,input().split())

		if com == 0:
			print(min(A[b:e]))
		else:
			print(max(A[b:e]))




Measured memory_bytes: 5624
def get_int
  gets.chop.to_i
end

def get_ints
  gets.chop.split.map(&:to_i)
end

def get_double
  gets.chop.to_f
end

def get_str
  gets.chop
end

def get_strs
  gets.chop.split
end

def main
  n = get_int
  ds = get_ints
  ans = 0
  0.upto(n - 2) do |i|
    (i+1).upto(n - 1) do |j|
      ans += ds[i] * ds[j]
    end
  end
  puts ans
end

if __FILE__ == $0
  main
end

Measured memory_bytes: 1788
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   long[] t = new long[N];
   for(int i=0;i<N;i++)  t[i] = sc.nextLong();
   
   long ans =t[0];
   for(int i=1;i<N;i++) 
   {
     if(ans >= t[i]) ans = ans/gcd(ans,t[i]) *t[i];
     else ans =ans/gcd(t[i],ans) * t[i];
   }
   System.out.println(ans);
 }
  static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
}

Measured memory_bytes: 21972
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static String[] S;
    static int[] I;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        S = new String[n];
        int[] P = new int[n];
        I = new int[n];
        for(int i = 0; i < n; i++) {
            S[i] = sc.next();
            P[i] = sc.nextInt();
            I[i] = i + 1;
        }
        mergeSort(P, 0, n-1);
        Arrays.stream(I).forEach(System.out::println);
    }
    public static void mergeSort(int[] A, int p, int r) {
        int q = (p + r) / 2;
        if(p < q) {
            mergeSort(A, p, q);
            mergeSort(A, q + 1, r);
        }
        merge(A, p, q, r);
    }

    private static void merge(int[] A, int p, int q, int r) {
        int[] L = new int[q-p+2];
        int[] R = new int[r-q+1];
        int[] LI = new int[q-p+2];
        int[] RI = new int[r-q+1];
        String[] LS = new String[q - p + 2];
        String[] RS = new String[r - q + 1];
        for(int i = 0; i < L.length - 1; i++) {
            L[i] = A[p + i];
            LS[i] = S[p + i];
            LI[i] = I[p + i];
        }
        for(int i = 0; i < R.length - 1; i++) {
            R[i] = A[q + i + 1];
            RS[i] = S[q + i + 1];
            RI[i] = I[q + i + 1];
        }
        L[q-p+1] = R[r-q] = LI[q-p+1] = RI[r-q] =  Integer.MAX_VALUE;
        LS[q-p+1] = RS[r-q] = "zzzzzzzzzzzzzzzzz";
        int i = 0;
        int j = 0;
        for(int k = p; k <= r; k++) {
            if(LS[i].compareTo(RS[j]) < 0) {
                I[k] = LI[i];
                S[k] = LS[i];
                A[k] = L[i++];
            } else if(LS[i].equals(RS[j])) {
                if(L[i] >= R[j]) {
                    I[k] = LI[i];
                    S[k] = LS[i];
                    A[k] = L[i++];
                } else {
                    I[k] = RI[j];
                    S[k] = RS[j];
                    A[k] = R[j++];
                }
            } else {
                I[k] = RI[j];
                S[k] = RS[j];
                A[k] = R[j++];
            }
        }
    }
}


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

int main(){
  string S;
  cin >> S;
  for(int i=0; i<S.size()-1; i++){
    if(S[i]=='A' && S[i+1]=='C'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	#define endl "\n"
	#define space " "
	#define ll long long int
	#define vl vector<ll>
	#define vvl vector < vll >
	#define pii pair<int,int>
	#define pll pair<ll,ll>
	#define vpl vector < pll >
	#define mod 1000000007
	#define pi 3.1415926535897932384626433
	#define inf 1000000000000000001;
	#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y) 
	#define mem(a,val) memset(a,val,sizeof(a))
	#define pb push_back
	#define f first
	#define s second
	
	void solve()
	{
		ll x,k,d;
		cin>>x>>k>>d;
		ll a=0,b=0,c=0,e=0,f=0;
		if(x<0){
			x=-x;
			a=x%d;
			b=x/d;
			if(k>=b){
				if((b&1)==(k&1)) f = a;
				else f=min(abs(a+d), abs(a-d));
			}
			else{
			c=k*d;
			f=x-c;
			}
		}
		else if(x>0){
		a = x%d;
		b = x/d;
		if(k>=b){
			if((b&1)==(k&1)) f=a;
			else f=min(abs(a+d), abs(a-d));
		}
		else{
			c=k*d;
			f=x-c;
		}
		}
		else{
			if(k%2==0) f=0;
			f=d;
		}
		cout<<f<<endl;
	}

	signed main()
	{

	fast;
	#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
     #endif

	ll T=1;
	// cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
	}


Measured memory_bytes: 3608
using System;

namespace abc95_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int value = 700;
            string order = Console.ReadLine();
            for(int i = 0; i < 3; i++)
            {
                if (order[i] == 'o')
                {
                    value = value + 100;
                }
            }
            Console.WriteLine(value);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>

using namespace std;

int main() {
    int i,j;

    for(i = 1;i <= 9;i++){
        for(j = 1;j <= 9;j++){
            cout << i << 'x' << j << '=' << i * j << endl; 
        }
    }

    return 0;
}

Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,x,t,a;	cin>>n>>x>>t;
	if(n%x==0)	a=n/x;
	else a=n/x+1;
	cout<<t*a<<endl;


    return 0;
}



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

int main() {
    ll A;
    double B;
    cin >> A >> B;
    ll C = round(B * 100);
    cout << A * C / 100 << endl;
}


Measured memory_bytes: 3680
import sys
roman={"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000}

for s in sys.stdin:
    x=[]
    tmp = roman[s[0]]
    x.append(tmp)
    for c in s[1:-1]:
        tmp = roman[c]
        if x[-1]<tmp: x[-1] *= -1
        x.append(tmp)
    print sum(x)

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

using namespace std;

int main()
{
   long long int n,i;

   cin >> n;

   long long int sum = 0;
  /* for(i = 0;i <n;i++)
   {

       sum = sum + (i+1)%(n-i);
   }*/
   n = n-1;
   sum = (n*(n+1))/2;
   cout << sum;
    /*for(i = 1;i <=n-1;i++)
   {

       sum = sum + (i)%(i+1);
   }
   cout << sum;*/
}


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

typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll,ll> Pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()

#define geti1(X) scanf("%d",&X)
#define geti2(X,Y) scanf("%d%d",&X,&Y)
#define geti3(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define geti4(X,Y,Z,W) scanf("%d%d%d%d",&X,&Y,&Z,&W)

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(__VA_ARGS__, geti4, geti3, geti2, geti1) (__VA_ARGS__)

#define INF 7654321
#define IINF 87654321987654321LL
#define MAXV 200500

ll mod = 1e9 + 7;
int N,M,T,K,tc;

int main(){
	int n; geti(n);
	vector<int> v;
	rep(i,n){int x; geti(x); v.pb(x);}
	sort(all(v)); reverse(all(v));
	bool f = false;
	int a = 0 , b = 0;
	for(auto e : v){
		if( f ) a += e;
		else b += e;
		f ^= 1;
	}
	printf("%d\n",b-a);
}


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

int gcd(int a, int b)
{
    if (a < b)
        gcd(b, a);
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    int n, r;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
        if (i)
        {
            if (i == 1)
                r = gcd(a.at(0), a.at(1));
            else
                r = gcd(r, a.at(i));
        }
    }
    cout << r << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#define UNVISITED -1
#define _ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
using namespace std;

typedef long long int64;
typedef pair<int, int> ii;

int main(){ _
  int64 n, k; cin >> n >> k;
  int64 ans = 0, base1 = 0, base2 = 0;
  if(n < k / 2) base1 = 0;
  else base1 = (k % 2) ? 0 : (n - k / 2) / k + 1;
  base2 = n / k;
  ans = base1 * base1 * base1 + base2 * base2 * base2;
  // cout << base1 << " " << base2 << endl;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 10000

int main()
{
  int n, T;
  int c, t;

  int min=MAX;

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

  for(int i=0 ; i<n ; i++) {
    scanf("%d %d", &c, &t);
    if(t <= T && c <= min) {
      min = c;
    }
  }

  if(min == MAX) {
    printf("TLE\n");
  } else {
    printf("%d\n", min);
  }
}


Measured memory_bytes: 128
import java.util.Scanner;

class Main{
  public static void main(String[] arg){
  	double r, menseki, ensyu;
  	Scanner in = new Scanner(System.in);
  	r = in.nextDouble();
  	menseki = r*r*Math.PI;
  	ensyu = r*2*Math.PI;
  	System.out.printf("%.6f %.6f",menseki,ensyu);
	}
}

Measured memory_bytes: 28244
// C
 #ifndef _GLIBCXX_NO_ASSERT
 #include <cassert>
 #endif
 #include <cctype>
 #include <cerrno>
 #include <cfloat>
 #include <ciso646>
 #include <climits>
 #include <clocale>
 #include <cmath>
 #include <csetjmp>
 #include <csignal>
 #include <cstdarg>
 #include <cstddef>
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
 #include <ctime> 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
 #include <ccomplex>
 #include <cfenv>
 #include <cinttypes>
 #include <cstdbool>
 #include <cstdint>
 #include <ctgmath>
 #include <cwchar>
 #include <cwctype>
 #endif
 
 // C++
 #include <algorithm>
 #include <bitset>
 #include <complex>
 #include <deque>
 #include <exception>
 #include <fstream>
 #include <functional>
 #include <iomanip>
 #include <ios>
 #include <iosfwd>
 #include <iostream>
 #include <istream>
 #include <iterator>
 #include <limits>
 #include <list>
 #include <locale>
 #include <map>
 #include <memory>
 #include <new>
 #include <numeric>
 #include <ostream>
 #include <queue>
 #include <set>
 #include <sstream>
 #include <stack>
 #include <stdexcept>
 #include <streambuf>
 #include <string>
 #include <typeinfo>
 #include <utility>
 #include <valarray>
 #include <vector> 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
 #include <array>
 #include <atomic>
 #include <chrono>
 #include <condition_variable>
 #include <forward_list>
 #include <future>
 #include <initializer_list>
 #include <mutex>
 #include <random>
 #include <ratio>
 #include <regex>
 #include <system_error>
 #include <thread>
 #include <tuple>
 #include <typeindex>
 #include <type_traits>
 #include <unordered_map>
 #endif
using namespace std;
int dp[110][100010];
int main(){
    int N,W; cin >> N >> W;
    vector<int> v(N),w(N);
    for(int i=0;i<N;++i) cin >> v[i] >> w[i];
    for(int i=0;i<N;++i) for(int j=0;j<=W;++j) dp[i][j] = -1;
    for(int i=0;i<W;++i) dp[0][i] = 0;
    for(int i=0;i<N;++i){
        for(int j=0;j<=W;++j){
            dp[i+1][j] = dp[i][j];
            if(j-w[i]>=0) dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]] + v[i]);
        }
    }
    cout << dp[N][W] << endl;
    return 0;
    
    }


Measured memory_bytes: 7376
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define INF 0x3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=1000000007;
const double PI = acos(-1.0);
const double epsilon = PI / 180.0;//角度转弧度 
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N = 1e3+10;

int main() {
	ll a;
	string s;
	cin>>a;
	cin>>s;
	int len = s.length();
	ll b = 0;
	rep(i, 0, len) {
		if(s[i] >= '0'&&s[i] <= '9') {
			b *= 10;
			b += s[i] - '0';
		}
	}
	ll c = (a * b);
	//c -= c % 100;
	cout<<(ll)(c / 100);
	return 0;
} 

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        var nx = ReadLine().Split().Select(int.Parse).ToArray();
        int N = nx[0];
        long x = nx[1];
        var r = ReadLine().Split().Select(long.Parse).ToArray();
        var a = new long[N + 2];
        for (int i = 0; i < N; i++)
        {
            a[i + 1] = r[i];
        }

        long ans = 0;
        for (int i = 0; i < N+1; i++)
        {
            long s = a[i] + a[i + 1];
            if (s > x)
            {
                a[i + 1] -= s - x;
                ans += s - x;
            }
        }
        WriteLine(ans);
    }
}


Measured memory_bytes: 39628
#![allow(unused_imports)]
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]

use std::{cmp, fmt};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};

fn main() {
    let (n, mut a) = {
        let mut sc = InputScanOnce::new(io::stdin(), 1024);
        let n = sc.next();
        (n, sc.vec::<i64>(n))
    };
    a.sort();
    let m = a[n - 1];
    let mut c = None::<(i64, i64)>;
    for &x in &a[..n - 1] {
        let r = (m - 2 * x).abs();
        if c.is_none() || r < c.unwrap().0 {
            c = Some((r, x));
        }
    }
    println!("{} {}", m, c.unwrap().1);
}

struct InputScanOnce {
    buf: Vec<u8>,
    pos: usize,
}

#[allow(dead_code)]
impl InputScanOnce {
    fn new<R: Read>(mut reader: R, estimated: usize) -> Self {
        let mut buf = Vec::with_capacity(estimated);
        let _ = io::copy(&mut reader, &mut buf).unwrap();
        InputScanOnce { buf: buf, pos: 0 }
    }

    #[inline]
    fn next<T: FromStr>(&mut self) -> T
    where
        T::Err: fmt::Debug,
    {
        let mut start = None;
        loop {
            match (self.buf[self.pos], start.is_some()) {
                (b' ', true) | (b'\n', true) => break,
                (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                (_, false) => start = Some(self.pos),
            }
        }
        let target = &self.buf[start.unwrap()..self.pos];
        unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        T::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
        T3::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        T::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }

    fn strings_as_mat<T, F: FnMut(u8) -> T>(&mut self, h: usize, mut f: F) -> Vec<Vec<T>> {
        (0..h)
            .map(|_| {
                let l = self.next::<String>();
                l.as_bytes().iter().cloned().map(&mut f).collect()
            })
            .collect()
    }
}


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

x_list=list(map(int,input().split()))

minn=1e99
a=max(x_list)

for i in range(1,a+1):
    sumn=0
    for x in x_list:
        sumn+=(x-i)**2
    
    if sumn < minn :
        minn=sumn


print(minn)

Measured memory_bytes: 38512
import numpy as np
n, k = map(int, input().split())
a = [list(map(int , input().split())) for _ in range(n)]
a = np.array(a, dtype=object)
p = 10**9 + 7

def mat_pow(a, n, mod):
    res = np.eye(len(a), dtype=object)
    while(n > 0):
        if(n & 1 == 1):
            res = res.dot(a) % mod
        a = a.dot(a) % mod
        n = n >> 1
    return res
ak = mat_pow(a, k, p)

print(ak.sum() % p)
"""
ans = 0
for i in range(n):
    for j in range(n):
        ans += ak[i, j]
        ans %= p

print(ans)
"""


Measured memory_bytes: 12508
#include <iostream>
#include <vector>

using namespace std;

vector<int> G[200000];
long add[200000];
bool used[200000];

void dfs(int v){
    used[v] = true;
    for(int i = 0; i < G[v].size(); i++){
        if(!used[G[v][i]]){
            add[G[v][i]] += add[v];
            dfs(G[v][i]);
        }
    }
}

int main(){
    int N, Q;
    cin >> N >> Q;
    for(int i = 0; i < N-1; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for(int i = 0; i < Q; i++){
        int p, x;
        cin >> p >> x;
        p--;
        add[p] += x;
    }
    dfs(0);
    for(int i = 0; i < N-1; i++){
        cout << add[i] << ' ';
    }
    cout << add[N-1] << endl;
}


Measured memory_bytes: 24448
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#define lp(i, l, r) for (int i = l; i <= r; ++i)
#define rp(i, r, l) for (int i = r; i >= l; --i)
#define ls(i, s) for (int i = 0; s[i]; ++i)
#define rs(i, s) for (int i = strlen(s) - 1; i >= 0; --i)
#define lv(i, a) for (int i = 0; i < int(a.size()); ++i)
#define rv(i, a) for (int i = (int)a.size() - 1; i >= 0; --i)
#define fast ios::sync_with_stdio(0), cin.tie(0)
#define prec(a) cout << setprecision(a) << fixed
#define appl(f, a) for (auto i = begin(a); i != end(a); f, ++i)
#define many for (int T = -1; T < 0 && cin >> T, T--;)
#define rang(a) begin(a), end(a)
#define gene template <class T>
#define endl '\n'
#define asse assert
using namespace std;
using namespace __gnu_pbds;
gene T inf() { return numeric_limits<T>::max(); }
gene int tmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
gene int tmax(T &a, T b) { return b > a ? a = b, 1 : 0; }
gene auto min(const T &a) { return *min_element(rang(a)); }
gene auto max(const T &a) { return *max_element(rang(a)); }
gene auto sum(const T &a) { return accumulate(rang(a), 0); }
gene auto gath(const T &a, const vector<int> &b) {
    vector<typename T::value_type> r;
    for (auto i : b)
        r.push_back(a[i]);
    return r;
}
gene void sort(T &a) { sort(rang(a)); }
gene void reve(T &a) { reverse(rang(a)); }
gene void uniq(T &a) { sort(a), a.erase(unique(rang(a)), end(a)); }
gene void shuf(T &a) { random_shuffle(rang(a)); }
gene void merg(T l, T m, T r) { inplace_merge(l, m, r); }
// template <typename... T> void in(T &... a) { ((cin >> a), ...); }
// template <typename... T> void ou(T... a) { ((cout << a << ' '), ...); }
template <class F, class S> auto &operator>>(istream &s, pair<F, S> &a) {
    return s >> a.first >> a.second;
}
template <class F, class S> auto &operator<<(ostream &s, const pair<F, S> &a) {
    return s << '(' << a.first << ", " << a.second << ')';
}
gene auto &operator>>(istream &s, vector<T> &a) {
    for (int i = -1; i < 0 && (!a.size() && (cin >> i, a.resize(i), 0), i = 0),
             i < int(a.size());)
        s >> a[i++];
    return s;
}
gene auto &operator<<(ostream &s, const vector<T> &a) {
    lv(i, a) cout << a[i] << (i + 1 == int(a.size()) ? "" : " ");
    return s;
}
gene using bbst =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
gene using heap = __gnu_pbds::priority_queue<T, greater<T>, pairing_heap_tag>;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
int main() {
    fast, prec(12);
    int n, m;
    cin >> n >> m;
    if (n == m)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
def A():
    temp = input().split()
    S = temp[0]
    T = temp[1]
    temp = [int(i) for i in input().split()]
    A = temp[0]
    B = temp[1]
    U = input()
    if U == S:
        print(A-1, B)
    else:
        print(A, B-1)

def B():
    print('x'*len(input()))
    
B()

Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

using namespace std;

int dp[3000][3000]={};

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

  int n,t;
  cin>>n>>t;
  vector<pair<int,int>> menu(n);
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    menu[i]=make_pair(a,b);
  }
  std::sort(menu.begin(), menu.end(),[](pair<int,int>& a,pair<int,int>& b){
    if(a.first!=b.first){
      return a.first<b.first;
    }else{
      return a.second>b.second;
    }
  });

  int dp_overflow[3000]={};
  for(int i=menu[0].first;i<t;i++){
    dp[0][i]=menu[0].second;
  }
  dp_overflow[0]=menu[0].second;
  int result=menu[0].second;
  for(int mi=1;mi<n;mi++){
    for(int last_eaten=0;last_eaten<t;last_eaten++){
      int next_time=last_eaten+menu[mi].first;
      if(next_time<t){
        dp[mi][next_time]=std::max(dp[mi-1][next_time],dp[mi-1][last_eaten]+menu[mi].second);
        result=std::max(result,dp[mi][next_time]);
      }
    }
  }
  for(int target=0;target<n;target++){
    for(int i=target+1;i<n;i++){
      result=max(result,menu[i].second+dp[target][t-1]);
    }
  }
  cout<<result<<endl;




  return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N,K;
    cin >> N >> K;
    vl A(N);
    rep(i,N)cin>>A[i];
    sort(all(A), greater<ll>());

    ll ans = 0;
    rep(i, K) ans += A[i];
    cout << ans << endl;
}

Measured memory_bytes: 256