akhauriyash/Code-Regression huggingface dataset:
#include "stdio.h"



int main(void) {

	int number;
	int array[100],barray[100];
	int sum = 0;
	
	scanf("%d", &number);

	for (int i = 1; i<number; i++) {
		scanf("%d", &barray[i]);
	}
	
	array[number] = barray[number - 1];

	for (int i = number - 1; i > 0; i--) {
		
		if (barray[i] >= barray[i - 1]&&i!=1) {
			array[i] = barray[i - 1];
		}
		else if (barray[i] < barray[i - 1]&&i != 1) {
			array[i] = barray[i];
		}
		else if (i = 1) {
			array[i] = barray[i];
		}
	}

	for (int i = 1; i <= number; i++) {
		sum += array[i];
	}

	printf("%d", sum);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int N, t, x, y, T{}, X{}, Y{};
  cin >> N;
  bool cond{true};
  for (int i = 0; i != N; ++i) {
    cin >> t >> x >> y;
    auto d = abs(X - x) + abs(Y - y);
    if (T + d > t || (t - T - d) % 2) {
      cond = false;
      break;
    }
    X = x, Y = y, T = t;
  }
  cout << (cond ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3540
// Marcin Knapik
#include<bits/stdc++.h>
// #pragma GCC optimize("O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds; 
// #define ordered_set tree< int , null_type,less< int >, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #define losuj(a, b) uniform_int_distribution<ull>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;

#define boost                   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second

template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}

template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template<class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template<class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<class T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }

const ll INF = 1e9 + 7;
const ll mod = 1186782211;
// const ll BIG_INF = 1000000000000000000;
const ll BIG_INF = 15000000000000;
const ll N = 1e6+7;
const ll T = 1<<20;
const ll Hope = 1000000123;

ll n, m, k, q;	

int main(){
	boost;

	ld x;
	cin >> x;

	cout <<setprecision(10) << fixed << (x / 3.0) * (x / 3.0) * (x / 3.0) << '\n';
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

int main() {
  string s;
  cin >> s;
  int m = stoi(s.substr(5, 2));

  if (m >= 5) {
    cout << "TBD" << endl;
  } else {
    cout << "Heisei" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <vector>

using namespace std;
using ll = long long;
using P = pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& v) {
    os << "(" << v.first << ", " << v.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    for (int i = 0; i < v.size(); i++) {
        if (i) os << ", ";
        os << v[i];
    }
    os << "}";
    return os;
}

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cout << "ACL";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3592
//g++  5.4.0

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

const int mod=1000000007;
const int ma=1005;
char s[ma][ma];


int main()
{
 int h,w,i,j;
    cin>>h>>w;
    vector<vector<int>>dp(h,vector<int>(w,0));
    for(i=0;i<h;i++)
        for(j=0;j<w;j++)cin>>s[i][j];
        
        dp[0][0]=1;
    for(i=0;i<h;i++)
    {
     for(j=0;j<w;j++)
     {
         for(int x:{i,i+1})
         {
          int y=j;
             if(x==i)y=j+1;
             
             if(x<h&&y<w&&s[x][y]=='.')
             {
              dp[x][y]+=dp[i][j];
                 if(dp[x][y]>=mod)
                     dp[x][y]-=mod;
                 
             }
             
             
         }
     }
        
    }
    
    cout<<dp[h-1][w-1];
    
    
    
        
    
}

Measured memory_bytes: 5120
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		
		if (S.chars().distinct().count() == 26) {
			System.out.println("None");
			return;
		}
		
		char min = 'a';
		for (char c : S.toCharArray()) {
			if (min == c) {
				min = (char)(min + 1);
			}
		}
		System.out.println(min);
	}
}

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

int main(){
  int COL;
  cin >> COL;
  vector<int> L1(COL);
  vector<int> L2(COL);
  for(int i = 0; i < COL; i++) cin >> L1[i];
  for(int i = 0; i < COL; i++) cin >> L2[i];
  
  // 下段の更新
  for(int i = COL - 2; i >= 0; i--) {
    L2[i] += L2[i+1];
  }
  
  //　上段の更新
  L1[COL-1] += L2[COL-1];
  for(int i = COL - 2; i >= 0; i--) {
    if (L1[i + 1] > L2[i]) L1[i] += L1[i+1];
    else L1[i] += L2[i];
  }
  
  cout << L1[0] << endl;
  return 0;
}


Measured memory_bytes: 256
m, d = map(int, input().split())

count = 0

if d <= 10:
    print(0)
    exit()
for j in range(4, m+1):
    for i in range(22, d+1):
        i = list(str(i))
        d1 = int(i[0])
        d2 = int(i[1])
        if d1 == 1 or d2 == 1:
            continue
        if d1*d2 == j:
            count += 1

print(count)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			System.out.println(((s[2] == s[3]) && (s[4] == s[5])) ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 23636
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque

INF = 1 << 50


class BIT:
    # init_val[0] -> bins[1]
    def __init__(self, n, init_val, init):
        self.n = n
        self.init_val = init_val
        self.init = init
        self.k = math.ceil(math.log2(n))

        try:
            init_val[0]
        except:
            raise ValueError('init_val should be list')

        self.bins = [self.init] * ((1 << self.k) + 1)
        for i, val in enumerate(self.init_val):
            bi = i + 1
            if bi & 1:
                self.bins[bi] = val
            else:
                ret = self.init
                most_sig = (bi & -bi)
                n_bit = bi - 1
                while n_bit:
                    v = n_bit & -n_bit
                    if most_sig >= v: break
                    ret = self.compare(ret, self.bins[n_bit])
                    n_bit -= v
                self.bins[bi] = ret

    def compare(self, l, r):
        return l + r

    def minus(self, val):
        return -val

    def update(self, idx, by, minus=False):
        '''idx : 0-started index'''
        if minus:
            by = self.minus(by)
        idx += 1
        while idx < len(self.bins):
            self.bins[idx] = self.compare(self.bins[idx], by)
            idx += (idx & -idx)

    def eval(self, idx):
        '''idx: 0-indexed'''
        ans = self.init
        idx += 1
        while idx:
            ans = self.compare(ans, self.bins[idx])
            idx -= (idx & -idx)
        return ans

    def eval_between(self, l, r):
        ''' l, r : 0-indexed '''
        return self.compare(self.eval(r), self.minus(self.eval(l - 1)))

def run():
    N, Q = map(int, sysread().split())
    right_arr = [-1] * (N+1)
    C = list(map(int, sysread().split()))

    L,R = [],[]
    for i in range(Q):
        l,r = map(int, sysread().split())
        L.append((l, i))
        R.append((r, i))
    perms = [i for r,i in sorted(R)]
    ans = [-1] * Q

    bit = BIT(N, init_val = [0]*N, init=0)
    checked = -1
    for perm in perms:
        r, i = R[perm]
        l, _ = L[perm]
        r -= 1
        l -= 1
        #print(l, r)
        for idx, c in enumerate(C[checked+1:r+1], checked+1):
            if right_arr[c] < idx:
                pre_idx = right_arr[c]
                right_arr[c] = idx
                if pre_idx != -1:
                    bit.update(pre_idx, by=1, minus=True)
                bit.update(idx, by=1, minus=False)
                #print(pre_idx, idx, c, seg.bins)
        sub = bit.eval(l-1) if l > 0 else 0
        val = bit.eval(r) - sub
        ans[i] = val
        checked = r
        #print(val)

    for a in ans:
        print(a)




if __name__ == "__main__":
    run()

Measured memory_bytes: 230484
x,y = map(int, input().split())
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]

if (x in g1 and y in g1) or (x in g2 and y in g2) or (x in g3 and y in g3):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include<stdio.h>

int main(void){
  int N,M; scanf("%d%d",&N,&M);
  int A[110];
  long int SUM = 0;//SUMは得票数の合計
  for(int i = 1;i <= N;i++){scanf("%d",&A[i]);}

  //Aをバブルソート
  for(int i = 1;i <= N;i++){
    for(int j = 1;j <= N-1;j++){
      int tmp;
      if(A[j] < A[j+1]){tmp = A[j] ; A[j] = A[j+1] ; A[j+1] = tmp;}
    }
    int count = 0;
    for(int j = 1;j <= N-1;j++){
      if(A[j] < A[j+1]){count += 1;}
    }
    if(count == 0){break;}
  }

  //SUM(得票数合計)を求める
  for(int i = 1;i <= N;i++){SUM += A[i];}
  //判定
  double r = SUM / (4*M);
  int r_extra = SUM % (4*M);
  int count = 0;
  for(int i = 1;i <= M;i++){
    if((A[i] < r) && (r_extra == 0)){count += 1;}
    else if((A[i] <= r) && (r_extra != 0)){count += 1;}
  }
  if(count == 0){printf("Yes");}
  else{printf("No");}

  return 0;
}


Measured memory_bytes: 128
n = int(input())
c_l = []
for i in range(3):
    c_l.append(list(map(int, input().split())))

point = 0
for j in range(n):
    if j >= 1:
        if c_l[0][j] == c_l[0][j-1] + 1:
            point += c_l[1][c_l[0][j]-1]
            point += c_l[2][c_l[0][j]-2]
        else:
            point += c_l[1][c_l[0][j]-1]
    elif j == 0:
        point += c_l[1][c_l[0][j]-1]
print(point)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author shivam
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int x = n / 1000;
            int y = n % 1000;
            if (y == 0) out.println(0);
            else {
                int ans = 1000 * (x + 1) - n;
                out.println(ans);
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 32812
n, p = map(int, input().split())
s = input()

ans = 0
if p in (2, 5):
    for i, j in enumerate(s):
        if int(j) % p == 0:
            ans += i + 1

else:
    cnt = [0] * p
    cnt[0] = 1
    now = 0
    for i, j in enumerate(reversed(s)):
        now = (int(j) * pow(10, i, p) + now) % p
        ans += cnt[now]
        cnt[now] += 1

print(ans)

Measured memory_bytes: 3500
import sys
input = sys.stdin.readline
N, C, K = [int(x) for x in input().split()]
T = [int(input()) for _ in range(N)]
T.sort()
depart = T[0] + K  # 出発時刻
passenger = 0  # 乗客数
bus = 1
for i in range(N):
    if passenger >= C or depart < T[i]:  # すでに満員または待ち時間オーバー
        bus += 1
        passenger = 1
        depart = T[i] + K
    else:
        passenger += 1

print(bus)

Measured memory_bytes: 13264
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        hoge();
        //System.Console.ReadLine();
    }

    public static void hoge()
    {
        var vars = System.Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var r = vars[0];
        

        System.Console.WriteLine(System.Math.PI * r * 2);
    }
}

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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  string N;
  cin >> N;
  bool flag = false;
  rep(i, N.size()) {
    if (N[i] == '7')
      flag = true;
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


		int i = 1;

			while(true){
			String str = br.readLine();
			int x = Integer.parseInt(str);
			if (x == 0) break;
			System.out.println("Case "+i+": "+x);
			i++;
			}
	}
}

Measured memory_bytes: 31328
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
	ll N,X,T;
  	cin>>N>>X>>T;
  	
  
  	cout<<((N+X-1)/X)*T<<endl;
}

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

int main(void) {
  string S, T;
  cin >> S >> T;
  cout << T + S << endl;
 
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 100


int main(){
	int a[N];
	int n, k;
	bool v = true;
	scanf("%d", &n);
	if (n < 0){
		n = n*(-2);
		v = false;
	}
	f(i, 50)a[i] = 0;
	k = 0;
	while (n > 0){
		if (n % 2 == 1){
			if (k % 2 == 0)a[k]++;
			else{
				a[k]++;
				a[k + 1]++;
			}
		}
		n = n / 2;
		k++;
	}
	k = 0;
	f(i, 50){
		if (a[i] > 0)k = i;
		while (a[i + 1] > 0&&a[i]>1){
			a[i + 1]--;
			a[i] -= 2;
		}
		a[i + 1] += (a[i] / 2);
		a[i + 2] += (a[i] / 2);
		a[i] = a[i] % 2;
	}

	if (v){
		f(i, k + 1)printf("%d", a[k - i]);
	}
	else{
		f(i, k)printf("%d", a[k - i]);
	}


	return 0;
}

Measured memory_bytes: 128
from itertools import combinations as comb


def main():
    k = int(input())
    pairs = list(comb(range(1, k+1), 2))

    ans = 0
    for pair in pairs:
        if pair[0] % 2 == 0 and pair[1] % 2 != 0:
            ans += 1
        elif pair[0] % 2 != 0 and pair[1] % 2 == 0:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int y = in.nextInt();
		int m = in.nextInt();
		int d = in.nextInt();
		if (y < 1868 || (y == 1868 && m < 9) || (y == 1868 && m == 9 && d < 8)) {
			out.println("pre-meiji");
		} else if (y < 1912 || (y == 1912 && m < 7) || (y == 1912 && m == 7 && d < 30)) {
			out.println("meiji " + (y-1867) + " " + m + " " + d);
		} else if (y < 1926 || (y == 1926 && m < 12) || (y == 1926 && m == 12 && d < 25)) {
			out.println("taisho " + (y-1911) + " " + m + " " + d);
		} else if (y < 1989 || (y == 1989 && m == 1 && d < 8)) {
			out.println("showa " + (y-1925) + " " + m + " " + d);
		} else {
			out.println("heisei " + (y-1988) + " " + m + " " + d);
		}
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		while(in.hasNext()) solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Measured memory_bytes: 25880
use std::collections::HashMap;

pub fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let mut dict = HashMap::new();
    let n = read1::<usize>();
    for _ in 0..n {
        let count = dict.entry(read1::<String>()).or_insert(0);
        *count += 1;
    }
    let m = read1::<usize>();
    for _ in 0..m {
        let count = dict.entry(read1::<String>()).or_insert(0);
        *count -= 1;
    }
    let ans = dict.iter().fold(0, |m, t| std::cmp::max(m, *t.1));
    println!("{:?}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const int L=1e5+10;

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

  int N;
  cin>>N;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];
  int Q;
  cin>>Q;

  vector<ll> num(L,0);
  rep(i,N) num[A[i]]++;
  ll sum=0;
  rep(i,N) sum+=A[i];

  rep(q,Q){
    ll B,C;
    cin>>B>>C;

    ll numb=num[B];
    sum-=B*numb;
    sum+=C*numb;
    num[C]+=numb;
    num[B]=0;

    cout<<sum<<"\n";
  }


  return 0;
}


Measured memory_bytes: 4776
#include<stdio.h>
#define MAX 10000
#define qu -1

struct Node{
  int C,left,right;
};
struct Node D[MAX];
int num;

void Po(int A){
  if(A==qu){
    return;
  }
  printf(" %d",A);
  Po(D[A].left);
  Po(D[A].right);
}

void Io(int A){
  if(A==qu){
    return;
  }
  Io(D[A].left);
  printf(" %d",A);
  Io(D[A].right);
}
void pP(int A){
  if(A == qu){
    return;
  }
  pP(D[A].left);
  pP(D[A].right);
  printf(" %d",A);
}

int main(){
  int i,v,left,right,root;
  scanf("%d",&num);
  for(i=0;i<num;i++){
    D[i].C=qu;
  }

  for(i=0;i<num;i++){
    scanf("%d %d %d",&v,&left,&right);
    D[v].left = left;
    D[v].right= right;
    if(left != qu){
      D[left].C=v;
    }
    if(right != qu){
      D[right].C = v;
    }
  }

    for(i=0;i<num;i++){
      if(D[i].C == qu){
	root = i;
      }
    }
      printf("Preorder\n");
      Po(root);
      printf("\n");
      printf("Inorder\n");
      Io(root);
      printf("\n");
      printf("Postorder\n");
      pP(root);
      printf("\n");
      

      return 0;
}
    



Measured memory_bytes: 2036
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  rep(i, S.size()){
    S[i] = (S[i] - 'A' + N) % 26 + 'A';
  }
  string ans = S;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<priority_queue<long long>> cakeScore(8);
    rep(i, N)
    {
        long long x, y, z;
        cin >> x >> y >> z;
        cakeScore[0].push(x + y + z);
        cakeScore[1].push(x + y - z);
        cakeScore[2].push(x - y + z);
        cakeScore[3].push(x - y - z);
        cakeScore[4].push(-x + y + z);
        cakeScore[5].push(-x + y - z);
        cakeScore[6].push(-x - y + z);
        cakeScore[7].push(-x - y - z);
    }
    long long ans = 0;
    rep(i, 8)
    {
        long long score = 0;
        rep(j, M)
        {
            score += cakeScore[i].top();
            cakeScore[i].pop();
        }
        ans = max(ans, score);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int INF = 1<<29;
int N;
int t[10005];
int dp[2][2][5005];

int main(){
  scanf("%d", &N);
  for(int i=1;i<N;i++) scanf("%d",&t[i]);
  for(int i=0;i<2;i++) for(int j=0;j<2;j++) for(int k=0;k<5005;k++) dp[i][j][k] = INF;
  dp[0][0][0]= 0;
  int cur=0, tar=1;
  for(int i=0;i<N;i++){
    cur = i&1, tar = (i+1)&1;
    //    printf("%d %d\n", tar, cur);
    for(int k=0;k<=min(i,N/2);k++){
      dp[tar][0][k+1] = min(dp[cur][0][k], dp[cur][1][k] + t[i]);
      dp[tar][1][k] = min(dp[cur][1][k], dp[cur][0][k] + t[i]);
    }
    dp[tar][0][0] = INF;
  }

  printf("%d\n", min(dp[tar][0][N/2], dp[tar][1][N/2]));
  return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> card(3, vector<int> (3));
  for (int i = 0; i < 3; i++) {
    cin >> card.at(i).at(0) >> card.at(i).at(1) >> card.at(i).at(2);
  }
  int N;
  cin >> N;
  for(int i = 0; i < N; i++) {
    int b;
    cin >> b;
    for(int j = 0; j < 3; j++) {
      for(int k = 0; k < 3; k++) {
        if (card.at(j).at(k) == b) {
          card.at(j).at(k) = 0;
        }
      }
    }
  }
  bool check = false;
  for(int i = 0; i < 3; i++) {
    if (card.at(i).at(0) == 0 && card.at(i).at(1) == 0 && card.at(i).at(2) == 0) {
      check = true;
    }
    if (card.at(0).at(i) == 0 && card.at(1).at(i) == 0 && card.at(2).at(i) == 0) {
      check = true;
    }
  }
  if (card.at(0).at(0) == 0 && card.at(1).at(1) == 0 && card.at(2).at(2) == 0) {
    check = true;
  }
  else if(card.at(0).at(2) == 0 && card.at(1).at(1) == 0 && card.at(2).at(0) == 0) {
    check = true;
  }
  if (check) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))

BC = []
for _ in range(M):
    b, c = map(int, input().split())
    BC.append((b, c))
    
cards = A[:]
opes = BC[:]

cards_dict = {}

for c in cards:
    if c in cards_dict:
        cards_dict[c] += 1
    else:
        cards_dict[c] = 1

for b, c in opes:
    if c in cards_dict:
        cards_dict[c] += b
    else:
        cards_dict[c] = b
        
cards_dict = sorted(cards_dict.items(), reverse=True)
#print(cards_dict)

num = 0
ans = 0
for k, v in cards_dict:
    if num + v > N:
        ans += k * (N-num)
        num = N
    else:
        ans +=  k * v
        num += v
    if num == N:
        break
        
print(ans)

    

            


Measured memory_bytes: 102332
#include<iostream>
#include<string>
using namespace std;
int main(void){
  string s1,s2,s3;
  cin>>s1>>s2>>s3;
  if(s1[s1.size()-1]==s2[0] && s2[s2.size()-1]==s3[0])cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}
  


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final int N = new Scanner(System.in).nextInt();
        System.out.println(solve(N));
    }

    static final int MOD = 1_000_000_007;

    private static long solve(int S) {
        if (S < 3) return 0;

        long res = 0;
        for (int i = 1; i <= S / 3; i++) {
            int reminder = S - i * 3;
            // C(reminder + i - 1, i -1)
            long count = factorialModulo(reminder + i - 1)
                    * modInverse(factorialModulo(i - 1)) % MOD
                    * modInverse(factorialModulo(reminder)) % MOD;
            res = (res + count) % MOD;
        }

        return (res + MOD) % MOD;
    }

    static long factorialModulo(long n) {
        long res = 1;
        for (int i = 2; i <= n; i++) {
            res = res * i % MOD;
        }
        return res;
    }

    // modInverse(num) * num == 1 (MOD)
    static long modInverse(long num) {
        // raise num to MOD-2 power.
        long base = num;
        long inverse = 1;
        int exp = MOD - 2;
        while (exp > 0) {
            if (exp % 2 == 1) inverse = inverse * base % MOD;
            base = base * base % MOD;
            exp /= 2;
        }
        return inverse;
    }
}

Measured memory_bytes: 35628
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <cassert>
#define SIZE 100005
#define MX 150000000000000000LL

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll X[SIZE],Y[SIZE];
int n;

bool check(ll d)
{
	int ans=0;
	for(int i=0;i<n;i++)
	{
		if(X[i]>d) continue;
		ll dist=d-X[i];
		ll S=Y[i];
		bool up=false;
		for(int j=60;j>=0;j--)
		{
			if(S>>j&1)
			{
				if((1LL<<j)>dist) S-=1LL<<j;
				else
				{
					if(S==(1LL<<j))
					{
						up=true;
						break;
					}
					S-=1LL<<j;
					dist-=1LL<<j;
				}
			}
		}
		if(!up) ans^=1;
	}
	return ans;
}
int main()
{
	scanf("%d",&n);
	ll big=1LL<<60;
	for(int i=0;i<n;i++)
	{
		scanf("%lld %lld",&X[i],&Y[i]);
		Y[i]+=big;
	}
	ll low=-MX,up=MX;
	while(up-low>1)
	{
		ll d=(low+up)/2LL;
		if(check(d)) up=d;
		else low=d;
	}
	printf("%lld\n",up);
	return 0;
}


Measured memory_bytes: 1664
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<queue>
#include<functional>
using namespace std;
#define MAX 100000

int main() {
	string s;
	cin >> s;
	replace(s.begin(), s.end(),',', ' ');
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, K;
ll dp[110][100010];
int T[100010];

void solve() {
	cin >> N >> K;
	vector<int> s;
	for(int i = 1; i * i <= N; i++) {
		s.pb(i); s.pb(N / i);
	}
	// debug(sz(s), K);
	s.pb(0);
	sort(all(s)); s.erase(unique(all(s)), s.end());
	rep(i, 1, sz(s)) {
		T[i] = lower_bound(all(s), N / s[i]) - s.begin();
	}
	dp[0][1] = 1;
	rep(i, 0, K) {
		rep(j, 1, sz(s)) ADD(dp[i][j + 1], dp[i][j]);
		rep(j, 1, sz(s)) {
			ADD(dp[i + 1][j], dp[i][T[j]] * (s[j] - s[j - 1]) % mod);
		}
	}
	ll res = 0;
	rep(j, 1, sz(s)) ADD(res, dp[K][j]);
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 79868
'''
(n - x) % 4

0 % 4 = 0
7 % 4 = 3
14 % 4 = 2
21 % 4 = 1

21以上なら7を0から3回引くことで4の倍数にできる
'''
n = int(input())
if n >= 21:
    flg = True
else:
    flg = False
    for i in range(21 // 4 + 1):
        for j in range(21 // 7 + 1):
            if 4 * i + 7 * j == n:
                flg = True
                break
print('Yes' if flg else 'No')

Measured memory_bytes: 2940
#include <iostream>

using namespace std;

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

  int cont = 0;
  for (int n = 0; n < N; ++n) {
    int d1, d2;
    cin >> d1 >> d2;
    if (d1 == d2) {
      ++cont;
    } else {
      cont = 0;
    }
    if (cont >= 3) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  
  return 0;
}


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

using namespace std;

const int NMAX=10100;
int n,q,c,x,y;
int r[NMAX]={0},p[NMAX]={0};

void make(int x){
    for(int i=0;i<x;++i){
        p[i]=i;
    }
}

void link(int x,int y){
    if(r[x]>r[y]){
        p[y]=x;
    }
    else{
        p[x]=y;
        if(r[x]==r[y]){
            r[y]++;
        }
    }
}

int find(int x){
    if(x!=p[x]){
        return p[x]=find(p[x]);
    }
    return x;
}

void unite(int x,int y){
    link(find(x),find(y));
}


bool same(int x,int y){
    return find(x)==find(y);
}

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

    make(n);

    for(int i=0;i<q;++i){
        cin>>c>>x>>y;
        if(c==0){
            unite(x,y);
        }
        else{
            if(same(x,y)){
                cout<<1<<endl;
            }
            else{
                cout<<0<<endl;
            }
        }
    }

    return 0;
}


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

A, B = [0], [0]

for i in range(n):
  A.append(a[i] + A[i])
for i in range(m):
  B.append(b[i] + B[i])

ans, j = 0, m
for i in range(n+1):
  if A[i] > k:
    break
  while B[j] > k - A[i]:
    j -= 1
  ans = max(ans, i+j)
print(ans)

Measured memory_bytes: 47412
#include<bits/stdc++.h>
using namespace std;
int ara[1000];
int main()
{
    int i,j,k,l,n,t,df,v;
    while(scanf("%d %d",&n,&k)!=EOF)
    {
        for(i=0;i<n;i++)
        {
            scanf("%d",&ara[i]);
        }
        sort(ara,ara+n);
        long long sum=0;
        for(i=n-1,j=1;j<=k;i--,j++)
        {
            sum+=ara[i];
        }
        printf("%lld\n",sum);
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

const int N = 2e5 + 7;
const int K = 62;

int up[K][N];

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);	
	
	int n, nd;
	cin >> n >> nd;
	for (int i = 0; i < n; i++) {
		cin >> up[0][i];
		up[0][i]--;
	}
	for (int i = 0; i + 1 < K; i++) {
		for (int j = 0; j < n; j++) {
			up[i + 1][j] = up[i][up[i][j]];
		}
	}
	int p = 0;
	for (int i = 0; i < K; i++) {
		if ((nd >> i) & 1) p = up[i][p];
	}
	cout << p + 1 << endl;
}


Measured memory_bytes: 100068
n = int(input())
p = [float(i) for i in input().split()]
dp = [[0 for i in range(len(p)+1)] for j in range(n)]
dp[0][0] = 1 - p[0]
dp[0][1] = p[0]
for i in range(1,n):
	for j in range(len(p)+1):
		dp[i][j] += (1-p[i])*dp[i-1][j]
		dp[i][j] += p[i]*dp[i-1][j-1]
sum1 = 0
for i in dp[n-1][n//2+1:]:
	sum1+=i
print(sum1)

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

class __ufnode
{
public:
    __ufnode *m_parent;
    int m_count;
 
    __ufnode()
    {
        m_parent = this;
        m_count = 1;
    }
 
    __ufnode *root()
    {
        return _getroot(this);
    }
 
    bool connect_to(__ufnode *t)
    {
        __ufnode *root = _getroot(this);
        __ufnode *target = _getroot(t);
        if( root == target ) return false;
        if( root->m_count > target->m_count )
        {
            target->m_parent = root;
            root->m_count += target->m_count;
        }
        else
        {
            root->m_parent = target;
            target->m_count += root->m_count;
        }
        return true;        
    }
 
private:
    __ufnode *_getroot(__ufnode *current)
    {
        if( current->m_parent == current ) return current;
        __ufnode *root = _getroot(current->m_parent);
        current->m_parent = root;
        return root;
    }
};
 
class unionfind
{
private:
    __ufnode *m_nodes;
    int m_size;
 
public:
    unionfind(int size)
    {
        m_nodes = new __ufnode[size];
        m_size = size;
    }
 
    ~unionfind()
    {
        delete m_nodes;
    }
 
    bool unite(int a, int b)
    {
        return m_nodes[a].connect_to(m_nodes + b);
    }
    
    bool issame(int a, int b)
    {
        return m_nodes[a].root() == m_nodes[b].root();
    }
 
    // すべてを連結。連結前に何個のグループにわけたか
    int connectall()
    {
        int count = 1;
        for( int i = 1; i < m_size; i++ )
        {
            if( unite(0, i) ) count++;
        }
        return count;
    }

    void *getroot(int a)
    {
        return (void *) m_nodes[a].root();
    }
};

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    unionfind uf(n);
    vector<int> *blocklist = new vector<int>[n];
    int *friendnum = new int[n];
    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        uf.unite(a, b);
        friendnum[a]++;
        friendnum[b]++;
    }

    rep(i, k)
    {
        int c, d;
        cin >> c >> d;
        c--; d--;
        blocklist[c].push_back(d);
        blocklist[d].push_back(c);       
    }

    map<void*, int> num;
    rep(i, n)
    {
        num[uf.getroot(i)]++;
    }

    rep(i, n)
    {
        int ans = num[uf.getroot(i)] - 1 - friendnum[i];
        for(auto itr = blocklist[i].begin(); itr != blocklist[i].end(); itr++ )
        {
            if( uf.issame(i, *itr) ) ans--;
        }
        
        cout << ans << " ";
    }
}

Measured memory_bytes: 15036
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int n,m;
char ss[200005];
int f[200005],qz[200005];
int main() {
	scanf("%d%d",&n,&m);
	scanf("%s",&ss[1]);
	bool mk = 0;
	int mx = 0;
	for(int i=1;i<=m;i++) {
		if(ss[i]!=ss[1]) { mk = 1; mx = i-1; break; }
	}
	if(!mk) {
		int ans = 1;
		f[0] = qz[0] = 1;
		for(int i=0;i<=n;i++) {
			if(i>=2) f[i] = qz[i-2];
			if(i!=0)qz[i] = (qz[i-1]+f[i])%mod;
			if(n-i>=2) ans = (ans+1ll*f[i]*(n-i)%mod)%mod;
		}
		printf("%d",ans);
		return 0;
	}
	if(n&1) {
		puts("0"); return 0;
	}
	int lx = 0;
	for(int i=1;i<=m;i++) {
		if(ss[i]==ss[1]) lx++;
		else {
			if(lx&1) mx = min(mx,lx);
			lx = 0;
		}
	}
	mx = mx/2+1;
	n/=2;
	f[0] = qz[0] = 1;
	int ans = 0;
	for(int i=0;i<=n;i++) {
		if(i) {
			f[i] = (qz[i-1] - (i-mx-1>=0?qz[i-mx-1]:0) )%mod;
			qz[i] = (qz[i-1]+f[i])%mod;
		}
		if(n-i<=mx) ans = (ans + 1ll * f[i]*2%mod*(n-i)%mod )%mod;
	}
	printf("%d",(ans%mod+mod)%mod );
}

Measured memory_bytes: 2048
//
// Created by yozaam on 23/06/20.
//

//
// Created by yozaam on 12/06/20.
//

//
// Created by yozaam on 04/06/20.
//



/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>




#define fo(start,n) for(size_t i = start; i < n; ++i)


// unordered_map<int,int>mp;
// mp.reserve(1024);            //FAST UMAP
// mp.max_load_factor(0.25);
typedef long long ll;



using namespace std;



int main() {
    // your code goes here
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll tc;
    cin>>tc;
    
        if(tc>29){
            cout<<"Yes";
        }else{
            cout<<"No";
        }
        cout<<"\n";
    
    return 0;
}
//
// Created by yozaam on 13/06/20.
//



Measured memory_bytes: 3608
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

using ll = long long int;
using namespace std;

int main(){
  
  // read problem
  ll N, tmp;
  vector<pair<ll,ll> > A;

  cin >> N;
  for(ll i = 0; i < N; i++){
    cin >> tmp;
    A.push_back(make_pair(tmp, i));
  }

  sort(A.begin(), A.end(), greater<pair<ll,ll> > ());

  cerr << "A: " << endl;
  for(ll i = 0; i < N; i++){
    cerr << A[i].first << " ";
  }cerr << endl;

  // solve problem
  vector<vector<ll> > dp(N+1, vector<ll>(N+1));

  for(ll i = 1; i <= N; i++){
    dp[i][0] = dp[i-1][0] + A[i-1].first*(A[i-1].second - (i-1));
    dp[0][i] = dp[0][i-1] + A[i-1].first*(N-i - A[i-1].second);
  }

  for(ll i = 1; i <= N; i++){
    for(ll j = 1; j <= N; j++){
      if(i+j>N){
        continue;
      }
      dp[i][j] = max(dp[i-1][j] + A[i+j-1].first*(A[i+j-1].second - (i-1)), dp[i][j-1] + A[i+j-1].first*(N-j-A[i+j-1].second));
    }
  }

  ll ans = 0;
  for(ll i = 0; i <= N; i++){
    ans = max(ans, dp[i][N-i]);
  }
  
  cerr << "Answer: " << endl;
  cout << ans << endl;

  return 0;


}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

vector<long long> makeprime(long long n) {
    vector<long long> factor;
    long long tmp = pow(n, 0.5) + 1;
    for (long long i = 2; i < tmp; i++) {
        while (n % i == 0) {
            n /= i;
            factor.push_back(i);
        }
    }
    if (n > 1) factor.push_back(n);
    return factor;
}

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

    ll x; cin >> x;
    while (true) {
        vector<ll> p = makeprime(x);
        if (p.size() == 1) {
            cout << x << endl;
            return 0;
        }
        x++;
    }
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	int n, x, ans = 0;
	cin >> n >> x;
	vector<int> m(n);

	for (int i=0; i < m.size(); i++) {
		cin >> m[i];
	}

	sort(m.begin(), m.end());

	for (int i=0; i < m.size(); i++) {
		if (x >= m[i]) {
			ans ++;
			x -= m[i];
		}
	}

	ans += x / m[0];

	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for(ll i = a; i < (ll)(b); i++)

#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

using namespace std;
using ll = long long;
using vel = vector<ll>;
using ves = vector<string>;

int main() {
    ll K;
    string S;
    cin >> K >> S;
    if(S.size() <= K){
        cout << S << endl;
    } else {
        cout << S.substr(0,K) << "..." << endl;
    }
}

Measured memory_bytes: 3628
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  int x,a;cin>>x>>a;
  if(x < a)cout << 0 << endl;
  else cout << 10 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int c,d;

  scanf("%d %d",&c,&d);

    if(c > d) {

      printf("a > b\n");

    }  else if (c == d) {

      printf("a == b\n");

    }  else {

      printf("a < b\n");

} return 0;

}


Measured memory_bytes: 1976
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

int main(void) {
  string s;
  int cnt = 0;
  while(cin >> s){
    bool f = true;
    for(int i=0; i<s.size(); i++){
      if( s[i] != s[s.size()-1-i] ) f = false;
    }
    cnt += f;
  }
  cout << cnt << endl;

  return 0;
}

// EOF

Measured memory_bytes: 3148
from heapq import heappush, heappop

n, m = [int(x) for x in input().split()]

temp_list = []
for _ in range(m + 1):
    temp_list.append([])
for _ in range(n):
    a, b = [int(x) for x in input().split()]
    if a > m:
        continue
    temp_list[a].append(-b)

h = []
ans = 0
for i in range(1, m + 1):
    for b in temp_list[i]:
        heappush(h, b)

    if len(h) == 0:
        continue
    
    ans -= heappop(h)
print(ans)

Measured memory_bytes: 17732
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std ;

int main(){
	vector<int> a(3) ;
	for(int i=0;i<3;i++) cin >> a.at(i) ;
	sort(a.begin(),a.end()) ;
	cout << a.at(0) << " " << a.at(1) << " " << a.at(2) << endl ;
}


Measured memory_bytes: 3160
#include<bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

int main(){
	fastio();
    int n; string s;
    cin>>n>>s;
    int r=0; int b=0;
    for(int i=0;i<n;i++)
        if(s[i]=='R')r++;
    else if(s[i]=='B')b++;
    if(r>b)cout<<"Yes";
    else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll INF =  1LL << 60;
const int inf = 1 << 30;
int n, m, x, y,q;ll z, w=0, sum = 0, ans = 0;
const int MAX = 510000;
const int MOD = 1000000007;
int main(void) {
	string s, t,ans; cin >> s >> t;
	int dp[3010][3010];
	Fill(dp, 0);
	rep(i, s.size()+1) {
		rep(j, t.size()+1) {
			if (s[i] == t[j])dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
			dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
			dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
		}
	}int i = s.size(), j = t.size();
	while (i > 0 && j > 0) {
		if (dp[i][j] == dp[i - 1][j]) i--;
		else if (dp[i][j] == dp[i][j - 1])j--;
		else {
			ans += s[i - 1]; i--; j--;
		}
	}reverse(ALL(ans));
	cout << ans << endl;
}


Measured memory_bytes: 38960