akhauriyash/Code-Regression huggingface dataset:
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin >> n >> s;
    map<char, ll> mp;
    rep(i, n)
    {
        mp[s[i]]++;
    }
    ll res2 = 0;
    rep3(i, 1, n)
    {
        rep(j, n)
        {
            if (i + i + j < n && (s[j] != s[i + j] && s[i + j] != s[i + i + j]&&s[j]!=s[i + i + j]))
            {
                // cout<<i<<" "<<j<<endl;
                res2++;
            }
        }
    }
    
    ll res = mp['R'] * mp['G'] * mp['B'];
   // cout<<res<<" "<<res2<<endl;
    cout << res - res2 << endl;
}


Measured memory_bytes: 3656
#include <iostream>
#include<math.h>
#include<stdio.h>
//#include<string>
using namespace std;
#define n 300000


int main(){
 int N,i,w_right=0,e_right=0,w_left=0
 ,e_left=0,ans,tmp;
 char S[n];
  std::cin >> N;
  for(i=0;i<N;i++)std::cin >> S[i];

  for(i=1;i<N;i++){
    if(S[i]=='W') w_right++;
    else e_right++;
  }


  if(S[0]=='W'){
     ans=e_right;
     w_left++;
   }
  else{
     ans=w_right;
     e_left++;
   }



   for(i=1;i<N;i++){
     if(S[i]=='W'){
       w_right--;
       w_left++;
     }
     else {
       e_right--;
       e_left++;
     }

     tmp=w_left+e_right;

     if(tmp<ans) ans=tmp;

   }

std::cout << ans << '\n';

return 0;


}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
# 整数の入力
S, T = map(str, input().split())
# スペース区切りの整数の入力
A, B = map(int, input().split())
# 文字列の入力
U = input()

if S == U:
    A -= 1
elif T == U:
    B -= 1


print("{} {}".format(A, B))


Measured memory_bytes: 2940
antenna = []
bool = True

for i in range(5):
    a = int(input())
    antenna.append(a)
max_distance = int(input())

for i in range(5):
    for j in range(5):
        if abs(antenna[i] - antenna[j]) > max_distance:
            bool = False
            
if bool:
    print("Yay!")
else:
    print(":(")

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define INF 2000000000
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int> P;
const ll MOD=1000000007;
using Graph = vector<vector<int>>;



int main() {
	string s;
	cin >> s;
	if (s[0] == s[1] && s[1] == s[2]) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	return 0;
}

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

#define fori(i,a,b) for (long long int i = a; i <= b ; ++i)
#define ford(i,a,b) for(long long int i = a;i >= b ; --i)
#define mk make_pair
#define mod 1000000007
#define pb push_back
#define ll long long
#define MAXN 300001
#define rnd mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().cnt())
#define pi pair<long long int,long long int>
#define sc second
#define fs first

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

  int n;
  cin >> n;
  string s;
  cin >> s;
  if (s[0] == 'W' || s[2*n-1] == 'W')
  {
    cout << 0 << endl;
    exit(0);
  }
  string t = "L";
  fori(i,1,2*n-1)
  {
    if (s[i] == s[i-1])
    {
      if (t[i-1] == 'L')
        t.pb('R');
      else
        t.pb('L');
    }
    else
    {
      if (t[i-1] == 'L')
        t.pb('L');
      else
        t.pb('R');
    }
  }
  //cout << t << endl;
  vector<int> L(2*n,0), R(2*n,0);
  L[0] = 1;
  fori(i,1,2*n-1)
  {
    if (t[i] == 'L')
      L[i] = L[i-1]+1;
    else
      L[i] = L[i-1];

    if (t[i] == 'R')
      R[i] = R[i-1]+1;
    else
      R[i] = R[i-1];
  }
  // fori(i,0,2*n-1)
  //   cout << L[i] << " " << R[i] << endl;
  if (L[2*n-1] != R[2*n-1])
  {
    cout << 0 << endl;
    exit(0);
  }
  //cout << "jai shree ram" << endl;
  ll ans = 1;
  fori(i,0,2*n-2)
  {
    if (t[i] == 'R')
    {
      ans = (ans*(L[i]-R[i]+1))%mod;
    }
  }
  ford(i,n,1)
  {
    ans = (ans*i)%mod;
  }
  cout << ans << endl;
  return 0;
}


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

long long num[100010]={0};

int main(void){
	
    long long n, k;
	cin >> n >> k;
	for(int i=0; i<n; i++){
		long long a;
		long long b;
		cin >> a >> b;
		num[a] += b;
	}

	long long sum=0, ans=0;

	for(long long i=1; i<100010; i++){
		sum += num[i];
		if(sum>=k){
			ans = i;
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
A, B, K = map(int, input().split())
c = [A, B]
for i in range(K):
    if c[i%2]%2 == 1:
        c[i%2] -= 1
    c[(i+1)%2] += c[i%2]//2
    c[i%2] //= 2
print(*c)

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	sort(a.begin(),a.end());
	vector<int> d(100000,0);
	rep(i,n){
		d[a[i]]++;
	}
	int ans = 0;
	for(int i = 2; i < 100000; i++){
		ans = max(d[i] + d[i-1] + d[i-2],ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3964
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;

int main()
{
	LL a, b, n ,m;
	scanf("%lld %lld",&a, &b);
	m = max(a, b);
	n = min(a, b);
	if(n == 1)
	{
		if(m == 1) printf("1\n");
		else if(m == 2)
			printf("0\n");
		else
			printf("%lld\n", m - 2);
	}
	else if(n == 2)
		printf("0\n");
	else
		printf("%lld\n",n * m - (2 * n + 2 * m - 4));
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val list: List<String> = readLine()!!.split(" ").map { it.toString() }
    isStable(bubbleSort(list.toTypedArray(),n),selectionSort(list.toTypedArray(),n),n)
}
fun selectionSort(A:Array<String>, N:Int):Array<String>
{
    var tmp:String
    for (i in (0..(N - 1))) {
        var minj :Int= i
        for (j in (i .. (N - 1)))
        {
            if (A[j][1] < A[minj][1])
            {
                minj = j
            }
        }
        if (A[minj] != A[i])
        {
            tmp = A[minj]
            A[minj] = A[i]
            A[i] =tmp
        }
    }
    println(A.joinToString(" "))
    return A
}

fun bubbleSort(A:Array<String>, N:Int):Array<String>
{
     // N 個の要素を含む 0-オリジンの配列 A
    var flag:Boolean = true// 逆の隣接要素が存在する
    var tmp:String

    while(flag) {
        flag = false
        for (j in ((N - 1) downTo 1))
        {
            if (A[j][1] < A[j - 1][1])
            {
                tmp = A[j - 1]
                A[j - 1] = A[j]
                A[j] = tmp
                flag = true
            }
        }
     }
    println(A.joinToString(" "))
    println("Stable")
    return A
}
fun insertionSort(A:IntArray, N:Int) // N個の要素を含む0-オリジンの配列A
{
    var v:Int
    println(A.joinToString(" "))
    for (i in (1..(N - 1))) {
        v = A[i]
        var j:Int = i - 1
        while ((j >= 0) && (A[j] > v)) {
            A[j + 1] = A[j]
            j--
        }
        A[j + 1] = v
        println(A.joinToString(" "))
    }
}

fun isStable(A:Array<String>, B:Array<String>,N:Int)
{
    for (i in (0..(N-1)))
    {
       if (A[i] != B[i])
        {
            println("Not stable")
            return
        }
    }
    println("Stable")
    return
}


Measured memory_bytes: 32564
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = readline().decode('utf-8').strip()
    w = int(readline())
    ans = ''
    for i in range(0, len(S), w):
        ans += S[i]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9056
import java.util.Scanner;

/**
 * Created by malone on 2018/3/16.
 */
public class Main{

    public static void main(String[] args) {
        int a, b;
        Scanner scanner = new Scanner(System.in);


        while (((a = scanner.nextInt()) != 0)&&((b = scanner.nextInt()) != 0)) {

            for (int i = 0; i < a; i++) {
                for (int j = 0; j < b; j++) {
                    if (i == 0 || i == a - 1) {
                        System.out.printf("#");
                    } else if (j == 0 || j == b - 1) {
                        System.out.printf("#");
                    } else {
                        System.out.printf(".");
                    }
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }

    }
}



Measured memory_bytes: 59788
#include <iostream>
#include <cstring>
#include <stdlib.h>
using namespace std;
int a[100],count=0;
void swap(int x,int y){
	int tmp;
	tmp=a[y];
	a[y]=a[x];
	a[x]=tmp;
	count++;
}
int main(int argc, char *argv[]) {
	int n,i,j,min;
	memset(a,0,sizeof(a));
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	for(i=0;i<n-1;i++){
		min=i;
		for(j=i+1;j<n;j++){
			if(a[j]<a[min])
				min=j;
		}
		if(i!=min)
			swap(i,min);
	}
	for(i=0;i<n;i++){
		if(i!=n-1)
			cout<<a[i]<<" ";
		else
			cout<<a[i]<<endl;
	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
int r,c,n;

bool onEdge(pair<int,int> p){
    return (p.first==0 ||p.first==r || p.second==0 || p.second==c);
}

int edgeInde(pair<int,int> pos){
    if(pos.first==0) return 0;
    if(pos.second==c) return 1;
    if(pos.first==r) return 2;
    if(pos.second==0) return 3;
    return -1;
}

bool comp(pair<int,pair<int,int>> lhs,pair<int,pair<int,int>> rhs){
    int linde=edgeInde(lhs.second);
    int rinde=edgeInde(rhs.second);
    if(linde<rinde) return true;
    if(linde>rinde) return false;
    if(linde==0){
        return lhs.second.second<rhs.second.second;
    }
    if(linde==1){
        return lhs.second.first<rhs.second.first;
    }
    if(linde==2){
        return lhs.second.second>rhs.second.second;
    }
    if(linde==3){
        return lhs.second.first>rhs.second.first;
    }
    throw("Unexpected");
}

int main(){    
    cin>>r>>c>>n;
    vector<pair<int,int>> p1(n),p2(n);
    vector<pair<int,pair<int,int>>> edge;
    for(int i=0;i<n;i++){
        int x1,y1,x2,y2;
        cin>>x1>>y1>>x2>>y2;
        p1[i]={x1,y1};
        p2[i]={x2,y2};
        if(onEdge(p1[i]) && onEdge(p2[i])){
            edge.push_back({i,p1[i]});
            edge.push_back({i,p2[i]});
        }
    }
    sort(edge.begin(),edge.end(),comp);

    vector<int> index(edge.size());
    for(int i=0;i<edge.size();i++){
        index[i]=edge[i].first;
    }
    
    stack<int> st;
    for(int i=0;i<index.size();i++){
        if(!st.empty() && st.top()==index[i]) st.pop();
        else st.push(index[i]);
    }
    cout<<(st.empty() ? "YES" : "NO")<<endl;
    return 0;
}

Measured memory_bytes: 6516
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

int main(){
    int N;
    int res = 0;

    cin >> N;
    int H[N];
    int dMax = 0;

    for(int i = 0; i < N; i++)
    {
        cin >> H[i];
        if(dMax <= H[i] )
        {
            dMax = H[i];
            res++;
        }
    }
    cout << res << endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define mod 998244353
#define SYOU(x) fixed<<setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii=pair<int, int > ;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol n,m,x,y;
  string s,w;
  lol a[12000];
  cin >>n;
  lol ans=0;
  for(int i=1;i<=n;i++){
    if(i%3!=0&&i%5!=0){
      ans+=i;
    }

  }
  cout <<ans<<'\n';
      
  return (0);
}


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

using ll = long long;
using pll = pair<long, long>;
#define all(x) (x).begin(), (x).end()

int main() {

    ll r, g, b, n;
    cin >> r >> g >> b >> n;

    ll ans = 0;
    for (auto i = 0; i <= n / r; i++) {
        ll n_n = n - r * i;
        for (auto j = 0; j <= n_n / g; j++) {
            ll n_n_n = n_n - g * j;
            if (n_n_n % b == 0)
                ans += 1;
        }
    }

    cout << ans;
    return 0;
}

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

bool check(int a, int b, int c) {
  if(a == b) return (a != c);
  else if(b == c) return (a != b);
  else if(c == a) return (c != b);
  else return false;
}

int main() {
  int A, B, C; cin >> A >> B >> C;
  if(check(A, B, C)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


n = I()
s = S()
print(s.count('ABC'))


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

int main () {
    long long a,b;
    cin >> a >> b;
    if (a%3 == 0 || b%3 == 0 || (a+b)%3 == 0){
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>  
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<deque>
#include<cstring>
#include<fstream>
#include<string>
#include<set>
#include<map>
#include<stack>
#include<queue>
using namespace std;
typedef long long LL;
int main() {
	int T;
	LL a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	cout << min(min(d*a + e*b, min(d, e) * 2 * c + (d > e ? (d - e)*a : (e - d)*b)), max(d,e)*2*c)<<endl;
	return 0;
}

Measured memory_bytes: 256
#![allow(bare_trait_objects)]
#![allow(unused_imports)]
#![allow(dead_code)]

use std::fmt::Debug;
use std::io::BufRead;
use std::io::Stdin;
use std::io::StdinLock;
use std::str::FromStr;

pub struct Scanner<'a> {
    // stdin: Stdin,
    buf_read: Box<BufRead + 'a>,
    tokens: Vec<String>,
}

impl<'a> Scanner<'a> {
    pub fn new(buf_read: StdinLock<'a>) -> Self {
        Scanner {
            buf_read: Box::new(buf_read),
            tokens: Vec::new(),
        }
    }

    // pub fn from_stdin() -> Self {
    //     let stdin = Box::leak(Box::new(std::io::stdin()));
    //     Self {
    //         buf_read: Box::new(stdin.lock()),
    //         tokens: Vec::new(),
    //     }
    // }

    pub fn next(&mut self) -> String {
        while self.tokens.is_empty() {
            let mut s = String::new();
            if self.buf_read.read_line(&mut s).is_err() {
                panic!()
            }
            self.tokens = s
                .split_whitespace()
                .filter(|s| !s.is_empty())
                .rev()
                .map(str::to_string)
                .collect();
        }
        self.tokens.pop().unwrap()
    }

    pub fn next_g<T: FromStr>(&mut self) -> T
    where
        T::Err: Debug,
    {
        self.next().parse().unwrap()
    }

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

    pub fn usize(&mut self) -> usize {
        self.next_g()
    }

    pub fn i64(&mut self) -> i64 {
        self.next_g()
    }

    pub fn vec_i64(&mut self, n: usize) -> Vec<i64> {
        self.next_vec_g(n)
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());

    let x = [
        1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4,
        1, 51,
    ];
    let n = sc.usize() - 1;
    println!("{}", x[n])
}


Measured memory_bytes: 4352
s=[int(i) for i in input().split()]
five_count=0
seven_count=0
for i in s:
    if(i==5):
        five_count+=1
    elif(i==7):
        seven_count+=1
if(five_count==2 and seven_count==1):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include<iostream>

using namespace std;

int main(void){
	int n;
	int a[30];
	while(1){
		int o=32;
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++)scanf("%d",&a[i]);
		int c=0;
		while(o!=0){
			o-=(o-1)%5;
			printf("%d\n",o);
			o-=a[c];
			if(o<0)o=0;
			printf("%d\n",o);
			c++;
			if(c==n)c=0;
		}
	}
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  cout << (a1 + a2 + a3 > 21 ? "bust" : "win") << endl;
  return 0;
}

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

class P
{
    static void Main(string[] _)
    {
        var O = Console.ReadLine().ToList();
        var E = Console.ReadLine().ToList();
        string r = "";
        int i = 1;
        char t;
        while (0 < O.Count + E.Count)
        {
            if ((i % 2 == 0 && 0 < E.Count) || 0 == O.Count)
            {
                r += E.First();
                E.RemoveAt(0);
            }
            else if ((i % 2 == 1 && 0 < O.Count) || 0 == E.Count)
            {
                r += O.First();
                O.RemoveAt(0);
            }
            i++;
        }
        Console.WriteLine(r);
    }
}

Measured memory_bytes: 11220
#include <algorithm>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

int l[100005];
int n;
void solve() {
  cin >> n;
  for(int i = 0; i < n; i++) cin >> l[i];
  for(int i = n-2; i >= 0; i--) {
    if(l[i] > l[i+1]) l[i]--;
  }
  for(int i = 1; i < n; i++) {
    if(l[i] < l[i-1]) {
      cout << "No\n";
      return;
    }
  }
  cout << "Yes\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  // casesolve();
  solve();
}


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

int main() {
  string S;
  cin >> S;

  set<char> st;
  for (int i = 0; i < (int)S.size(); i++) {
    char c = S.at(i);
    st.insert(c);
  }

  for (int i = (int)'a'; i <= (int)'z'; i++) {
    char c = (char)i;
    if (st.find(c) == st.end()) {
      cout << c << endl;
      return 0;
    }
  }

  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int main(void){
    string s; cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4) << endl;

    return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  int N;
  vector< long long > A;
  vector< long long > B;
  cin >> N;
  for(int i = 0;i < N;i++){
    int a,b;
    cin >> a >> b;
    A.push_back(a);
    B.push_back(b);
  }
  int max = 0,maxi = 0;
  for(int i = 0;i < N;i++){
    if(A[i] > max){
      max = A[i];
      maxi = i;
    }
  }
  long long sum = 0;
  sum = max + B[maxi];
  cout << sum << endl;
}


Measured memory_bytes: 2036
K = int(input())
A = [i for i in range(1, 10)]
count = 10
for i in range(0, K-1):
    if K >= 10:
        for j in range(0, 10):
            if abs(j - A[0] % 10) <= 1 and count <= K:
                A.append(A[0]*10+j)
                count += 1
        del A[0]
if K < 10:
    print(A[K-1])
else:
    print(A[-1])

Measured memory_bytes: 5912
#include <bits/stdc++.h>
using namespace std;
int n,k;
vector<int> arr(100006);
vector<int> dp(100006,-1);
int jump(int n)
{
	if (n==1)
		return 0;
	if(dp[n] != -1)
		return dp[n];
	int ans = INT_MAX;
	for(int i=1;i<= min(n,k);i++)
	{
		if(i == n) continue;
		ans = min (ans,abs(arr[n]-arr[n-i])+jump(n-i));
	}
	return dp[n] = ans;
}
int32_t main()
{
	cin >> n >> k;
	for(int i=1 ; i<=n ; i++)
	{
		cin >> arr[i];
	}
	cout << jump(n);
}

Measured memory_bytes: 5760
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

const bool ready = [](){
    std::ios_base::sync_with_stdio(false); std::cin.tie(0);
    std::cout << std::fixed << std::setprecision(12);
    return true;
}();

const double PI = acos(-1);
typedef long long ll;
#define int ll
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

void solve() {
    cini(k)
    cins(s);

    if(s.size()<=k)
        cout<<s<<endl;
    else
        cout<<s.substr(0,k)+"..."<<endl;
}

signed main() {
    solve();
}

// DO NOT JUMP BETWEEN PROBLEMS


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main(void){
    
    string s1, s2, s3;
    char a1, a2, a3;
    
    cin >> s1 >> s2 >> s3;
    
    a1 = s1[0] - 32;
    a2 = s2[0] - 32;
    a3 = s3[0] - 32;
    
    cout << a1 << a2 << a3 << endl;
    
    return 0;
    
}


Measured memory_bytes: 256
import java.io.PrintWriter

val pw = PrintWriter(System.out)
fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    var (n,r) = listOfInt()
    var ans = r
    if (n < 10){
        ans += 100*(10-n)
    }
    println(ans)
}

// 入力取得
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() =listOfString().map { it.toInt() }
fun listOfLong() =listOfString().map { it.toLong() }
fun listOfDouble() =listOfString().map { it.toDouble() }

// 約数のList
fun divisor(value : Long) : List<Long> {
    val max = Math.sqrt(value.toDouble()).toLong()
    return (1..max)
        .filter { value % it == 0L }
        .map { listOf(it, value / it) }
        .flatten()
        .sorted()
}

// 範囲内の素数を取得
// fromだけ指定すると戻り値の個数で素数判定ができる
fun prime(from : Long, to : Long = from) : List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j ->  i % j != 0L }
    }
}

// 素因数分解
fun decom(value : Long) : List<Long>{
    if (value == 1L) return listOf(1)
    val max = Math.sqrt(value.toDouble()).toLong()
    return prime(2, max).filter { value % it == 0L }
}

// 最大公約数
fun gcd(a : Long, b : Long) : Long {
    return if (a % b == 0L) b else gcd(b, a % b)
}

// 文字列を入れ替え
fun swap(base : String, a : String, b : String) : String {
    return base.map {
        when (it) {
            a.toCharArray()[0] -> b
            b.toCharArray()[0] -> a
            else -> it.toString()
        }
    }.joinToString()
}

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 35984
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U & u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U & u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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 (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, A, B;
	cin >> N >> A >> B;
	cout << min(N * A, B) << endl;
	return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)

int N,R;
int main(){
	fast;
	
	cin>>N>>R;
	
	if (N >= 10) cout<<R;
	else cout<<R + (1000 - 100 * N);
}




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

int main(){
    string s;
    int k;
    cin >> s >> k;
    vector<string> subs;
    int len = s.size();

    for(int i=0;i < len; i++){
        for(int j=1; j<=k; j++){
            if(i + j <= len){
                subs.push_back(s.substr(i, j));
            }
        }
    }
    sort(subs.begin(), subs.end());
    unique(subs.begin(), subs.end());

    cout << subs.at(k-1) << endl;

}

Measured memory_bytes: 1660
#include <iostream>
#define ll long long
using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	int d[10];
	for (int i = 0; i < k; ++i)
	{
		cin >> d[i];
	}
	while(true){
		int tmp;
		tmp = n;
		bool flag = true;
		while(tmp != 0){
			int num;
			num = tmp % 10;
			tmp -= num;
			tmp /= 10;
			for (int i = 0; i < k; ++i)
			{
				if(d[i] == num){
					flag = false;
				}		
			}
		}
		if(flag){
			cout << n << endl;
			return 0;
		}
		n++;
	}


}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

using vi = vector<int>;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define show(x) cout << #x << " = " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define YesNo {cout<<"Yes";}else{cout<<"No";}
#define YESNO {cout<<"YES";}else{cout<<"NO";}
#define v(T) vector<T>

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> bool lcmp(const pair<T, T>& l, const pair<T, T>& r) {
  return l.first < r.first;
}
template<class T> istream& operator>>(istream& i, v(T)& v) {
  F0R(j, sz(v)) i >> v[j];
  return i;
}
template<class A, class B> istream& operator>>(istream& i, pair<A, B>& p) {
  return i >> p.first >> p.second;
}
template<class A, class B, class C> istream& operator>>(istream& i, tuple<A, B, C>& t) {
  return i >> get<0>(t) >> get<1>(t) >> get<2>(t);
}
template<class T> ostream& operator<<(ostream& o, const vector<T>& v) {
  F0R(i, v.size()) {
    o << v[i] << ' ';
  }
  o << newl;
  return o;
}
template<class T1, class T2> ostream& operator<<(ostream& o, const map<T1, T2>& m) {
  for (auto& p : m) {
    o << p.first << ": " << p.second << newl;
  }
  o << newl;
  return o;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  // 1. a,b,c全てKの倍数
  // 2. a,b,c全てそれぞれKで割ったときのあまりがK/2に等しい
  // このどちらか。

  int N, K;
  cin >> N >> K;

  i64 a = N / K;
  i64 r = a * a * a;

  if (!(K & 1)) {
    a = (N + K / 2) / K;
    r += a * a * a;
  }
  cout << r;
}
#endif


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

using ll = long long;

unsigned xor128() {
    static unsigned x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned t = x ^ (x << 11);
    x = y; y = z; z = w;
    return w = w ^ (w >> 19) ^ (t ^ (t >> 8));
}

struct node;
using T = pair<ll, int>;
using node_ptr = std::shared_ptr<node>;

struct node {
    T val;
    node_ptr lch, rch;
    int size;
    node(T val, node_ptr l = nullptr, node_ptr r = nullptr)
        : val(val), lch(l), rch(r), size(1)
    {}
};

node_ptr create_node(T val) {
    return std::make_shared<node>(val);
}


int count(node_ptr t) {
    return !t ? 0 : t->size;
}

node_ptr update(node_ptr t) {
    t->size = count(t->lch) + count(t->rch) + 1;
    return t;
}

node_ptr merge(node_ptr l, node_ptr r) {
    if(!l || !r) return !l ? r : l;
    if(xor128() % (l->size + r->size) < (unsigned)l->size) {
        l->rch = merge(l->rch, r);
        return update(l);
    } else {
        r->lch = merge(l, r->lch);
        return update(r);
    }
}

std::pair<node_ptr, node_ptr> split(node_ptr t, int k) {
    assert(0 <= k && k <= count(t));
    if(!t) return std::make_pair(nullptr, nullptr);
    if(k <= count(t->lch)) {
        auto s = split(t->lch, k);
        t->lch = s.second;
        return std::make_pair(s.first, update(t));
    } else {
        auto s = split(t->rch, k - count(t->lch) - 1);
        t->rch = s.first;
        return std::make_pair(update(t), s.second);
    }
}

void insert(node_ptr& t, int k, T val) {
    auto x = split(t, k);
    t = merge(merge(x.first, create_node(val)), x.second);
}
void erase(node_ptr& t, int k) {
    auto x = split(t, k);
    t = merge(x.first, split(x.second, 1).second);
}

T kth_element(node_ptr t, int k) {
    assert(k < t->size);
    if(k < count(t->lch)) return kth_element(t->lch, k);
    if(k == count(t->lch)) return t->val;
    return kth_element(t->rch, k - count(t->lch) - 1);
}

int lower_bound(node_ptr t, const T& v) {
    if(!t) return 0;
    if(v <= t->val) return lower_bound(t->lch, v);
    return lower_bound(t->rch, v) + count(t->lch) + 1;
}

void insert_key(node_ptr& t, const T& v) {
    insert(t, lower_bound(t, v), v);
}
void erase_key(node_ptr& t, const T& v) {
    erase(t, lower_bound(t, v));
}

int main() {
    int n, c;
    cin >> n >> c;
    node_ptr s;
    vector<ll> score(n);
    for(int i = 0; i < n; ++i) {
        insert_key(s, make_pair(0, i + 1));
    }
    for(int i = 0; i < c; ++i) {
        int type;
        cin >> type;
        if(type == 0) {
            int t, p;
            cin >> t >> p;
            erase_key(s, make_pair(score[t - 1], t));
            score[t - 1] -= p;
            insert_key(s, make_pair(score[t - 1], t));
        } else {
            int m;
            cin >> m;
            auto res = kth_element(s, m - 1);
            cout << res.second << ' ' << -res.first << endl;
        }
    }
}



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

int main() {
    ll N;
    cin >> N;
    ll ans = 0;
    for(ll i=1; i<N+1; i++){
        if(i%3!=0 && i%5!=0) ans+=i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
n = int(input())
b = list(map(int, input().split()))
a = []
for i in range(n):
  if i == 0:
    a.append(b[i])
  elif i == (n - 1):
    a.append(b[i-1])
  else:
    a.append(min(b[i], b[i-1]))
print(sum(a))

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

int main()
{
  int n;
  cin >> n;
  int ans;
  int b;
  for(int i = n; i <= 200000; i++){
    b = 1;
    for(int j = 2; j <= (int)sqrt(i); j++){
      if(i % j == 0){
        b = 0;
        break;
      }
    }
    if(b){
      ans = i;
      break;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
MOD = 998244353
N = gets.to_i
robots = Array.new N 
N.times do |i|
  robots[i] = gets.split.map(&:to_i)
end
robots.sort_by!{|x| x[0] }
notouched = Array.new N

class MaxSegmentTree
  def initialize n, init
    @n = n 
    @init = init
    @offset = 2 ** (Math.log2(n).to_i + 1)
    @tree = Array.new(2*@offset, @init )
  end

  def update pos, val
    pos += @offset
    @tree[pos] = val
    while pos > 1
      pos = pos / 2
      @tree[pos] = max(@tree[2*pos], @tree[2*pos+1])
      break if @tree[pos] > val
    end
  end

  def query l,r 
    l += @offset
    r += @offset
    ret = @init
    while l<=r && ret != N
      ret = max(ret, max(@tree[r], @tree[l]))
      r = (r-1) / 2
      l = (l+1) / 2
    end
    return ret
  end
end

def max a, b 
  a > b ? a : b
end

segtree = MaxSegmentTree.new(N, 0)
dp = Array.new(N + 1)
dp[N] = 1
N.times do |i|
  x = N - 1 - i
  d = robots[x][0] + robots[x][1]
  l = x
  r = N
  unless robots[N-1][0] < d
    while l + 1 < r do
      c = ( l + r ) / 2
      if robots[c][0] >= d
        r = c
      else
        l = c
      end
    end
  end
  ro = r
  if ro  != N
    xro = segtree.query(x+1,ro-1)
    ro = xro if xro > ro
    notouched[x] = ro
    dp[x] = ( dp[x+1] + dp[notouched[x]] ) % MOD
  else
    dp[x] = ( dp[x+1] + 1 )
  end
  segtree.update(x, ro)
end

puts dp[0] % MOD

Measured memory_bytes: 25480
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;
int itt(string s){
    int a = 0;
    int n = s.size();
    fol(i,n){
        a += (s[n-i-1]-'0')*pow(10,i);
    }
    return a;
}
int main(){
    string a,b;cin>>a>>b;
    bool flag=false;
    int c = itt(a+b);
    int d = pow(100100,0.5);
    fol(i,d){
        if (i*i==c)flag=true;
    }
    if(flag){
        cout << "Yes"<<endl;
    }else{
        cout << "No"<<endl;
    }
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    if(n == 1) {
        cout << "Hello World" << endl;
    } else {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
}

Measured memory_bytes: 256
package main

import (
        "fmt"
        "sort"
)

func main() {
        var n, m int
        fmt.Scan(&n, &m)
        a := make([]int, m)
        b := make([]int, m)
        for i := 0; i < m; i++ {
                fmt.Scan(&a[i], &b[i])
        }
        sort.Sort(Sort{a, b})

        c := 0
        cnt := 0
        for i := 0; i < m; i++ {
                if a[i] < c {
                        continue
                }
                c = b[i]
                cnt++
        }
        fmt.Println(cnt)
}

type Sort struct {
        a []int
        b []int
}

func (s Sort) Len() int           { return len(s.b) }
func (s Sort) Less(i, j int) bool { return s.b[i] < s.b[j] }
func (s Sort) Swap(i, j int)      { s.a[i], s.a[j], s.b[i], s.b[j] = s.a[j], s.a[i], s.b[j], s.b[i] }

Measured memory_bytes: 5504
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1e-9;

int main() {

    int n;
    cin>>n;
    int w;
    vi v,x(n);
    rep(i,n)cin>>x[i];
    rep(i,n){
        w=x[i];
        v.pb(w);
        Sort(v);
        vi ans=v;
        for(int j=i+1;j<n;j++){
            ans.pb(x[j]);
        }
        dump(ans);
    }
}




Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    constexpr int P = 12;
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> C(N);
    vector<vector<int>> A(N,vector<int>(M));
    REP(i,N) {
        cin >> C[i];
        REP(j,M) cin >> A[i][j];
    }

    const int INF = 1 << 30;
    int p = pow(2,N);
    int ans = INF;
    REP(i,p) {
        bitset<P> bs(i);
        int tmp = 0;
        vector<int> at(M);
        REP(j,N) {
            if (bs[j]) {
                tmp += C[j];
                REP(k,M) {
                    at[k] += A[j][k];
                }
            }
        }
        bool ok = true;
        REP(k,M) {
            if (at[k] < X) {
                ok = false;
                break;
            }
        }
        if (ok) ans = min(ans,tmp);
    }

    if (ans != INF) cout << ans << '\n';
    else OUT(-1)

    return 0;
}

Measured memory_bytes: 4072
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)



int main(){
string T,S;
cin>>S>>T;
ll ts = T.size();
ll ss = S.size();

ll match=0;
for(ll i=0;ss>=i+ts;i++){
    ll num=0;
    for(int j=0;j<T.size();j++){
        if(T[j]==S[j+i]){
            num++;
        }
    }
    match=max(match,num);
}

cout<<ts-match<<endl;







}











Measured memory_bytes: 3596
# Import
from collections import deque
import math

# I/O
def read(): return input()

def read_int(): return int(input())

def read_array(type=int): return [type(i) for i in input().split()]

def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
S = read()
print(S[:3])

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

int main(void)
{
    string S;
    cin >> S;

    if (S[2] == S[3] && S[4] == S[5])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return (0);
}

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

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define VREV(v) reverse(v.begin(),v.end())
#define REV(v,n) reverse(v,v+n)
#define vi vector<int>
#define pf push_front
#define pb push_back

template<class T, size_t N> size_t countof(const T (&array)[N]) { return N; }
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }

void print(){cout<<"\n";}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}

void mprint(auto *matrix,auto N){
	REP(i,N) cout<<matrix<<(i!=N-1?' ':'\n');
	return;
}

const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

#define P pair<int,int>
#define Pll pair<ll,ll>
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

inline int in(){int x; cin>>x; return x;}

struct UnionFind{
	vector<int> par; //データiが属する親の番号
	vector<int> sizes; //根ノードiの木に含まれるデータの数

	// 最初は全てのデータiがグループiに存在するものとして初期化
	UnionFind(int n):par(n),sizes(n, 1){
		REP(i,n) par[i] = i;
	}

	// 根を張り替えながら再帰的に根ノードを探す
	int find(int x){
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}

	// 2つのデータx, yが属する木をマージする
	void unite(int x, int y) {
		// データの根ノードを得る
		x = find(x);
		y = find(y);

		// 既に同じ木に属しているならマージしない
		if (x == y) return;

		// xの木がyの木より大きくなるようにする
		if (sizes[x] < sizes[y]) swap(x, y);

		// xがyの親になるように連結する
		par[y] = x;
		sizes[x] += sizes[y];
		sizes[y] = 0;  // sizes[y]は無意味な値となるため
	}

	// 2つのデータx, yが属する木が同じならtrueを返す
	bool same(int x, int y) {
		return find(x) == find(y);
	}

	// データxが含まれる木の大きさを返す
	int size(int x) {
		return sizes[find(x)];
	}
};
int gcd(int n,int m){
	if(m>n) return gcd(m,n);
	if(m==0) return n;
	else return gcd(m,n%m);
}

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

	int N;
	string S;
	cin>>N>>S;

	REP(i,S.size()){
		S[i]=(S[i]+N);
		if(S[i]>=91) S[i]-=26;
	}

	print(S);

	return 0;
}


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

using namespace std;



int main(void){
    int n, m, intcount = 0;
    vector<int> vec[200000];
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        vec[tmp1-1].push_back(tmp2-1);
    }
    for(int i = 0; i < vec[0].size(); i++){
        for(int j = 0; j < vec[vec[0][i]].size(); j++){
            if(vec[vec[0][i]][j] == n-1){
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 8576
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string x;
    cin>>x;
    for(int i=0;i<x.length();i++)
        if(x[i]=='A'&&x[i+1]=='C'){cout<<"Yes"<<endl;return 0;}
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())

if a <= b <= c:
	print(a, b, c)
elif a <= c <= b:
	print(a, c, b)
elif b <= a <= c:
	print(b, a, c)
elif b <= c <= a:
	print(b, c, a)
elif c <= a <= b:
	print(c, a, b)
elif c <= b <= a:
	print(c, b, a)

Measured memory_bytes: 7672
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;


int main()
{
	int  a;
	int i = 0;
	cin >> a;
	int max = 0;
	if (a > 999 || a < 100)
		return 0;
	int index = a / 100;
	if (a > index*100+index*10+index)
		cout << (index + 1) * 100 + (index + 1) * 10 + index + 1;
	else
		cout << index * 100 + index * 10 + index;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256