akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

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);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        void solve(InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            out.println((int) Math.ceil((a + b) / 2.0));
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

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

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

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

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

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		int[][] c = new int[3][3];
		int[] a = new int[3];
		int[] b = new int[3];
		
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < 3; j++) {
				c[i][j] = sc.nextInt();
			}
		}
		int count = 0;
		for(int i = 0; i <= 100; i++) {
			for(int j = 0; j <= 100; j++) {
				a[0] = i; b[0] = j;
				if(a[0] + b[0] != c[0][0]) continue;
				else {
					a[1] = c[1][0] - b[0];
					a[2] = c[2][0] - b[0];
					b[1] = c[0][1] - a[0];
					b[2] = c[0][2] - a[0];
					for(int k = 1; k < 3; k++) {
						for(int l = 1; l < 3; l++) {
							if(c[k][l] == a[k] + b[l]) {
								count++;
							}else {
								count = 0;
							}
						}
					}
					if(count == 4) {
						System.out.println("Yes");
						return;
					}
					count = 0;
				}
			}
		}
		System.out.println("No");
		sc.close();
	}

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

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> V(N);
    REP(i,N) cin >> V[i];

    int R = min(N,K);
    ll ans = 0;
    for(int a=0;a<=R;a++){
        for(int b=0;a+b<=R;b++){
            ll tmp = 0;
            vector<int> sum;
            REP(i,a){
                sum.push_back(V[i]);
                tmp += V[i];
            }
            REP(i,b){
                sum.push_back(V[N-1-i]);
                tmp += V[N-1-i];
            }
            sort(sum.begin(),sum.end());
            if(K-a-b > 0){
                for(int k=0;k<min(K-a-b,(int)sum.size());k++){
                    if(sum[k] < 0) tmp -= sum[k], sum[k] = 0;
                }
            }
            chmax(ans, tmp);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	/*
	 * 122C
	 * 
	 * This problem requires prefix sum array
	 * Let's define a boolean array k[i] 
	 * k[i] = true when s[i] == 'A' and s[i+1] == 'C'
	 * Make a prefix sum array of k and then query with it
	 * 
	 * COMMON MISTAKE MAKE SURE YOU DO R-1 BECAUSE S[R+1] GOES OVER THE RANGE
	 * COMMON MISTAKE THIS IS ONE-INDEXED STRING
	 * 
	 * Time Complexity O(N), Memory Complexity O(N)
	 * 
	 */
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Q = sc.nextInt();
		String s = sc.next();
		int pre[] = new int[N+1];
		for(int i = 1; i<N; i++) {
			if(s.charAt(i-1) == 'A' && s.charAt(i) =='C') {
				pre[i] = 1; //initially the prefix sum array is the k array
			}
		}
		//Building the psa
		for(int i = 1; i<N; i++) {
			pre[i] += pre[i-1];
		}
		//Querying
		while(Q-- > 0) {
			int l = sc.nextInt(), r = sc.nextInt();
			r--;
			System.out.println(pre[r] - pre[l-1]);
		}
	}
}


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

using namespace std;

int main() {
    string str;
    cin >> str;
    long long int K;
    cin >> K;

    long long int counter=1;
    long long int cnt_mnp=0;
    bool is_same_chrs=false;
    bool is_first=true;
    long long int first_c;
    long long int last_c;
    for(int i=1; i<str.size(); i++) {
        if(str[i-1]==str[i]) {
            counter++;
            if(i==str.size()-1) {
                last_c = counter;
                cnt_mnp += counter/2;
            }
        } else {
            cnt_mnp += counter/2;
            if(is_first) {
                first_c = counter;
                is_first=false;
            }
            counter = 1;
        }
    }
    if(last_c==0) last_c++;
    

    if(counter==str.size()) {
        is_same_chrs = true;
    }
    
    if(str[0]==str[str.size()-1]) {
        if(is_same_chrs) {
            cout << K*str.size()/2 << endl;
        } else {
            if(last_c%2!=0 && first_c%2!=0) {
                cout << K-1+cnt_mnp*K << endl;
            } else {
                cout << cnt_mnp*K << endl;
            }
        }
    } else {
        cout << K*cnt_mnp << endl;
    }


    return 0;
    
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N, X int
	fmt.Scan(&N, &X)
	c := 0
	min := 1000
	var m int
	for i := 0; i < N; i++ {
		fmt.Scan(&m)
		X -= m
		if m < min {
			min = m
		}
		c++
	}
	c += X / min
	fmt.Println(c)
}


Measured memory_bytes: 512
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#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++)
const int INF = 1001001001;

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

int gcd(vector<int> A)
{
    int ans = A[0];
    for (int i = 1; i < A.size(); i++)
    {
        ans = gcd(ans, A[i]);
    }
    return ans;
}

int main()
{
    int N, X;
    cin >> N >> X;
    vector<int> v(N);
    rep(i, N)
    {
        int ipt;
        cin >> ipt;
        v.at(i) = abs(X - ipt);
    }
    cout << gcd(v) << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <queue>
#include <utility>
using namespace std;
int main() {
    int H,W,cnt = 0,oi = 0,t = 0,y;

    cin >> H >> W;

    string s[H];

    for(int i = 0;i<H;i++){
        cin >> s[i];
    }

    int dist[1000][1000] = {};
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            dist[i][j] = -100000000;
        }
    }
    queue< pair<int, int> > que;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(s[i][j] == '#'){
                que.push(make_pair(i,j));
                dist[i][j] = 0;
            }
        }
    }

    while(!que.empty()){
        pair<int, int> tmp = que.front();
        que.pop();
        int y = tmp.first;
        int x = tmp.second;
        if(y > 0){
            if(dist[y - 1][x] == -100000000){
                dist[y - 1][x] = dist[y][x] + 1;
                que.push(make_pair(y - 1, x));
            }
        }
        if(x > 0){
            if(dist[y][x - 1] == -100000000){
                dist[y][x - 1] = dist[y][x] + 1;
                que.push(make_pair(y, x - 1));
            }
        }
        if(y < H - 1){
            if(dist[y + 1][x] == -100000000){
                dist[y + 1][x] = dist[y][x] + 1;
                que.push(make_pair(y + 1, x));
            }
        }
        if(x < W - 1){
            if(dist[y][x + 1] == -100000000){
                dist[y][x + 1] = dist[y][x] + 1;
                que.push(make_pair(y, x + 1));
            }
        }
    }
    
    int ans = 0;
    for(int i = 0; i < H ;i++){
        for(int j = 0; j < W; j++){
            if(ans < dist[i][j]){
                ans = dist[i][j];
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 13456
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;

int main()
{
    fast_io
    ll i,j,n,h,w,a,b;
    cin>>n>>h>>w;
    ll ans=0;
    while(n--)
    {
        cin>>a>>b;
        if(a>=h&&b>=w)
     ans++;
     
    }

    cout<<ans<<endl;

    return 0;
}





Measured memory_bytes: 3612
#include<stdio.h>
#include<math.h>
int count;
int main(){
  char S[200005],T[200005];
  scanf("%s",S);
  scanf("%s",T);
  for (int i=0;S[i]!='\0';i++){
    if (S[i]!=T[i])
    count++;
  }
  printf("%d\n",count);
}


Measured memory_bytes: 2080
from collections import deque

H, W = map(int, input().split())

H += 2
W += 2

grid = "#" * W
for _ in range(H - 2):
    grid += "#" + input() + "#"
grid += "#" * W


def bfs(start):
    INF = 10 ** 9
    dist = [INF] * (H * W)
    dist[start] = 0
    q = deque([start])
    while q:
        v = q.popleft()
        dv = dist[v]
        for move in (-1, 1, W, -W):
            # next place
            w = v + move
            # wall or not
            if grid[w] == "#":
                continue

            dw = dv + 1
            if dw >= dist[w]:
                continue
            dist[w] = dw
            q.append(w)

    return max(x for x in dist if x < INF)


answer = max(bfs(v) for v in range(H * W) if grid[v] != "#")
print(answer)


Measured memory_bytes: 3316
// Simple Calculator.cc
// ２つの整数 a, b と１つの演算子 op を読み込んで、a op b を計算するプログラムを
// 作成して下さい。
// ただし、演算子 op は、"+"(和)、"-"(差)、"*"(積)、"/"(商)、のみとし、
// 割り算で割り切れない場合は、小数点以下を切り捨てたものを計算結果とします。
// 【入力】
// 入力は複数のデータセットから構成されています。各データセットの形式は以下のとおりです：
//   a op b
// op が '?' のとき 入力の終わりを示します。このケースの出力は行ってはいけません。
// 【出力】
// 各データセットについて、計算結果を１行に出力して下さい。
// 【制約】
// ・0 ≤ a, b ≤ 20000
// ・0 による割り算が与えられることはありません。
// 【例】
// 入力：
// 1 + 2
// 56 - 18
// 13 * 2
// 100 / 10
// 27 + 81
// 0 ? 0
// 出力：
// 3
// 38
// 26
// 10
// 108
#include<iostream>
using namespace std;

int main( void) {
  int a, b;
  char op;

  while ( true) {
    cin >> a >> op >> b;

    if ( op == '?') break;

    if ( op == '+') cout << a+b << endl;
    else if ( op == '-') cout << a-b << endl;
    else if ( op == '*') cout << a*b << endl;
    else cout << a/b << endl;
  }

  return 0;
}



Measured memory_bytes: 3080
#include <stdio.h>
 
int main(){
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  if(a+b==c+d){
    printf("Balanced\n");
  }else if(a+b>c+d){
    printf("Left\n");
  }else{
    printf("Right\n");
  }
  return 0;
}

Measured memory_bytes: 128
#define TEST_SNO	1
#define TEST_ENO	1
#define ll			long long

#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

typedef struct data {
	int a;
	int b;
} data;

FILE *in, *ans;
int tno;

int out(const char *s) {
#ifdef TEST
	char buf[8192];
	fgets(buf, sizeof(buf), ans);
	if (strcmp(buf, s)) {
		printf("err\n");
	}
#else
	printf(s);
#endif
	return 0;
}

int outi(int i) {
	char s[128];
	sprintf(s, "%d\n", i);
	out(s);
	return 0;
}

int outll(ll l) {
	char s[128];
	sprintf(s, "%lld\n", l);
	out(s);
	return 0;
}

int geti() {
	int i;
	fscanf(in, "%d", &i);
	return i;
}

ll getll() {
	ll l;
	fscanf(in, "%lld", &l);
	return l;
}

int getstr(char *s) {
	fscanf(in, "%s", s);
	return 0;
}

int fnc() {

	int i;

	int n = geti();

	int m = geti();
	int w = 1;

	for (i = 1; i < n; i++) {
		int v = geti();
		if (v >= m) {
			m = v;
			w++;
		}
	}

	outi(w);

	return 0;
}

int main() {
#ifdef TEST
	for (tno = TEST_SNO; tno <= TEST_ENO; tno++) {
		char str[128];
		sprintf(str, "test%d.txt", tno);
		in = fopen(str, "r");
		sprintf(str, "ans%d.txt", tno);
		ans = fopen(str, "r");
		fnc();
		fclose(in);
		fclose(ans);
	}
	printf("end\n");
#else
	in = stdin;
	fnc();
#endif

	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

#define INFTY 1000000001
#define MAX 500000

void merge(int *, int, int, int);
void mergeSort(int *, int, int);

int cnt=0;

int main(void)
{
	int i, n, S[MAX];
	
	scanf("%d",&n);
	for (i=0; i<n; i++) {
		scanf("%d",&S[i]);
	}
	
	mergeSort(S, 0, n);
	for(i=0; i<n-1; i++) {
		printf("%d ",S[i]);
	}
	printf("%d\n",S[n-1]);
	printf("%d\n",cnt);
	
	return 0;
}

void merge(int *A, int left, int mid, int right)
{
	int i, j, n1, n2, k;
	int L[MAX/2 +2], R[MAX/2 +2];
	
	n1 = mid - left;
	n2 = right - mid;
	for (i=0; i<n1; i++) {
		L[i] = A[left + i];
	}
	for (i=0; i<n2; i++) {
		R[i] = A[mid + i];
	}
	L[n1] = INFTY;
	R[n2] = INFTY;
	
	i = 0;
	j = 0;
	for (k=left; k<right; k++) {
		if( L[i] <= R[j] ) {
			A[k] = L[i];
			i++;
			cnt++;
		} else {
			A[k] = R[j];
			j++;
			cnt++;
		}
	}
}

void mergeSort(int *A, int left, int right)
{
	int mid;
	if( left + 1 < right ) {
		mid = ( left + right ) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}

Measured memory_bytes: 4504
#include<iostream>
#include<algorithm>
using namespace std;
using ll=long long;

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=max(max(a*c,a*d),max(b*c,b*d));
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}




void smain() {

    string s;
    cin>>s;
    for(int i=0;i<SZ(s);i++){
        if(s[i]=='?'){
            s[i]='D';
        }
    }
    cout<<s;



}

Measured memory_bytes: 3768
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

class Pos{
public:
	int x;
	int y;
	Pos(int _x,int _y) : x(_x),y(_y){}	
};

bool used[500];

int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;
		memset(used,0,sizeof(used));
		vector<Pos> flags;

		for(int i=0;i<n;i++){
			int x,y;
			scanf("%d %d",&x,&y);
			flags.push_back(Pos(x,y));
		}


		double dist = 0.0;
		Pos mdir(0,1);
		Pos prev(0,0);

		for(int i=0;i<n;i++){

			double minv = 100.0;
			int next = -1;

			double lineDist = numeric_limits<double>::max();

			for(int j=0;j<n;j++){
				if(used[j]) continue;
				int line_dirx = flags[j].x-prev.x;
				int line_diry = flags[j].y-prev.y;

				double tmpDist = sqrt((double)(flags[j].x-prev.x)*(flags[j].x-prev.x) 
				+ (double)(flags[j].y-prev.y)*(flags[j].y-prev.y));

				//double na = sqrt((double)mdir.x*mdir.x+(double)mdir.y*mdir.y);
				//double nb = sqrt((double)line_dirx*line_dirx+(double)line_diry*line_diry);

				double ab = mdir.x*line_dirx + mdir.y*line_diry;
				double axb = mdir.x*line_diry - mdir.y*line_dirx;
  
				double angle = atan2(axb,ab);

				if(angle <= 0.0 + EPS & abs(angle) < abs(minv)){
					next = j;
					minv = angle;	
					lineDist = tmpDist;
				}

				else if(minv - EPS < angle && angle < minv + EPS){
					if(tmpDist < lineDist){
						next = j;
						lineDist = tmpDist;
					}							
				}
			}

			if(next==-1) break;

			dist += sqrt((double)(flags[next].x-prev.x)*(flags[next].x-prev.x) 
				+ (double)(flags[next].y-prev.y)*(flags[next].y-prev.y));
			mdir = Pos(flags[next].x-prev.x,flags[next].y-prev.y);

			prev = Pos(flags[next].x,flags[next].y);		
			used[next] = true;
		}
		//dist *= 10.0;
		//dist = floor(dist);
		//dist /= 10;
		printf("%.1lf\n",dist);
	}
}

Measured memory_bytes: 0
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt()-1;
    int b = sc.nextInt()-1;
    int c = sc.nextInt()-1;
    int d = sc.nextInt()-1;
    String s = sc.next();
    sc.close();
    char[] ch = s.toCharArray();
    //boolean root = true;
    boolean change = false;
    for (int i=a+1;i<Math.max(c,d)-1;i++){
      if (ch[i] == '#'){
        i++;
        if (ch[i] == '#'){
          //root = false;
          System.out.println("No");
          System.exit(0);
        }
      }
    }
    if (c>d){
      int count = 0;
      for (int i=b-1;i<d+2;i++){
        if (ch[i] == '.'){
          count++;
          if (count ==3){
            System.out.println("Yes");
            System.exit(0);
          }
        }else{
          count = 0;
        }
      }
      System.out.println("No");
      System.exit(0);
    }else{
      System.out.println("Yes");
    }
  }
}

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

#define debug(x) cout << (#x) << " is " << x << endl;
#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;

#define N 200005
lli a[N];

int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n; i++) cin >> a[i];
    lli ans = a[0]*a[1];
    lli sum = a[0]+a[1], mod = 1e9+7;
    for(int i=2; i<n; i++){
		ans = (ans + sum*a[i])%mod;
		sum = (sum+a[i])%mod;
	}
	cout << ans%mod << endl;
 
    return 0;
}


Measured memory_bytes: 5176
def check(p):
    for i in range(1, 9):
        if p[i] != p[0]:
            return False
    for i in range(10, 12):
        if p[i] != p[9]:
            return False
    for i in range(13, 15):
        if p[i] != p[12]:
            return False
    for i in range(16, 18):
        if p[i] != p[15]:
            return False
    for i in range(19, 21):
        if p[i] != p[18]:
            return False
    for i in range(22, 30):
        if p[i] != p[21]:
            return False
    return True
    
    
def turn1(p):
    p[6], p[21] = p[21], p[6]
    p[7], p[22] = p[22], p[7]
    p[8], p[23] = p[23], p[8]
    p[12], p[17] = p[17], p[12]
    p[9], p[11] = p[11], p[9]
    

def turn2(p):
    p[0], p[27] = p[27], p[0]
    p[1], p[28] = p[28], p[1]   
    p[2], p[29] = p[29], p[2]
    p[14], p[15] = p[15], p[14]
    p[18], p[20] = p[20], p[18]
    
def turn3(p):
    p[0], p[23] = p[23], p[0]
    p[3], p[26] = p[26], p[3]
    p[6], p[29] = p[29], p[6]
    p[20], p[9] = p[9], p[20]
    p[17], p[15] = p[15], p[17]

def turn4(p):
    p[2], p[21] = p[21], p[2]
    p[5], p[24] = p[24], p[5]
    p[8], p[27] = p[27], p[8]
    p[18], p[11] = p[11], p[18]
    p[14], p[12] = p[12], p[14]


def search(p, cnt):
    if cnt == 8:
        return cnt
    if check(p):
        return cnt
    
    r = 100
    turn1(p)
    r = min(r, search(p, cnt+1))
    turn1(p)
    turn2(p)
    r = min(r, search(p, cnt+1))
    turn2(p)
    turn3(p)
    r = min(r, search(p, cnt+1))
    turn3(p)
    turn4(p)
    r = min(r, search(p, cnt+1))
    turn4(p)

    return r


N = int(input())
for l in range(N):
    p = [int(i) for i in input().split()]
    print(search(p, 0))


Measured memory_bytes: 5632
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

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

    int N;
    cin >> N;

    cout << pow(N, 3) << endl;
}

Measured memory_bytes: 384
use proconio::input;
use std::collections::HashMap;

fn helper(
  map: &HashMap<usize, usize>,
  val: usize
) -> bool {
  if let Some(v) = map.get(&val) {
    if &1 < v { return false }
  }
  
  let mut i = 2;
  while i * i <= val {
    if val % i == 0 {
      if map.get(&i).is_some() || map.get(&(val / i)).is_some() {
        return false;
      }
    }
    i += 1;
  }
  true
}

fn main() {
  input! {
    n: usize,
    vals: [usize;n]
  };
   
  let mut map = HashMap::new();  
  for i in 0..n {
    let entry = map.entry(vals[i]).or_insert(0);
    *entry += 1;
  }
  
  if let Some(v) = map.get(&1) {
    if v == &1 {
      println!("1");    
    } else {
      println!("0");
    }
    return
  }
  
  let mut result = 0;
  for v in vals {
    if helper(&map, v) {
      result += 1;
    }
  }
  println!("{}", result);
}

Measured memory_bytes: 11568
N = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
Cs = list(map(int, input().split()))

sum = 0
for i in range(N):
    sum += Bs[As[i]-1]
    if i != N-1 and As[i+1] == As[i]+1:
        sum += Cs[As[i]-1]

print(sum)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String strn = input.readLine( );
		int n = Integer.parseInt(strn);

		String stra = input.readLine( );
		String[] stralist = stra.split(" ");
		int[] a = new int[n];
		int count = 0;

		for(int i=0; i<n; i++){
			a[i] = Integer.parseInt(stralist[i]);
			if(a[i]%2 == 0){
				count = count+1;
			}
		}

		Arrays.sort(a);

		long answer = 1;
		if(n==1){
			if(a[0]==0){
				System.out.println(1);
			}else{
				System.out.println(0);
			}
		}else if(count==0){
			for(int i=0; i<n; i++){
				if(i%2 == 0 && a[i] != i+1){
					System.out.println(0);
					break;
				}else if(i%2 == 1 && a[i] != i){
					System.out.println(0);
					break;
				}
				if(i%2==0){
					answer = answer * 2 % ((long) Math.pow(10, 9) + 7);
				}
				if(i==n-1){
					System.out.println(answer);
				}
			}
		}else if(count==n){
			for(int i=1; i<n; i++){
				if(i%2 == 0 && a[i] != i){
					System.out.println(0);
					break;
				}else if(i%2 == 1 && a[i] != i+1){
					System.out.println(0);
					break;
				}
				if(i%2==0){
					answer = answer * 2 % ((long) Math.pow(10, 9) + 7);
				}
				if(i==n-1){
					System.out.println(answer);
				}
			}
		}else{
			System.out.println(0);
		}
	}
}



Measured memory_bytes: 38544
#include <iostream>
#include <string.h>
#include<algorithm>
#include<math.h>

using namespace std;

int main() {
	int N, M, A[10000],SUM=0;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> A[i];
		SUM += A[i];
	}
	if (N-SUM < 0)cout << -1 << endl;
	else cout << N - SUM << endl;
	return 0;
}

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

#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

int main(){
    ll n, limit;
    cin >> n >> limit;

    ll w[n], v[n];
    rep(i, n)cin >> w[i] >> v[i];

    ll dp[n+1][limit+1];
    rep(i, n+1)rep(j, limit+1)dp[i][j] = 0;

    rep(i, n)rep(j, limit+1){
        dp[i+1][j] = dp[i][j];
        if(j >= w[i])dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]] + v[i]);
    }

    cout << dp[n][limit] << endl;
}

Measured memory_bytes: 79104
import java.math.BigDecimal;
import java.util.*;

public class Main {

    static BigDecimal MAX = new BigDecimal(1_000_000_000_000_000_000L);
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
            if(a[i] == 0) {
            	System.out.println(0);
            	return;
            }
        }
        BigDecimal d = new BigDecimal(a[0]);
        for (int i = 1; i < n; i++) {
            d = d.multiply(new BigDecimal(a[i]));
            if(d.compareTo(MAX) == 1){
            	System.out.println(-1);
            	return;                
            }
        }
        System.out.println(d.longValue());
        
        sc.close();

    }

}


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

using namespace std;

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

#define N 100010
#define M 200010
#define endl "\n"
#define mod 1000000007 

int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(NULL);
	
	int n, d, k, ans = 0;
	map<int, int> mp;
	
	cin >> n >> k;
	for(int i = 0; i < k; i++){
		cin >> d;
		
		for(int j = 0; j < d; j++){
			int x;
			
			cin >> x;
			mp[x]++;
		}
	}
	
	for(int i = 1; i <= n; i++){
		if(mp[i] <= 0){
			ans++;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

int main() {
  int n; cin >> n;
  vec a(n);
  int xsum = 0;
  rep(i,n) {
    cin >> a[i];
    xsum ^= a[i];
  }

  rep(i,n) {
    int b = a[i] ^ xsum;
    printf("%d ", b);
  }
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;
#define pow10(n) int(1e##n + n)

void solve()
{
    int N, M;
    cin >> N >> M;
    cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 896
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,a,b,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>m;
  std::vector<ll> v(n,0);
  rep(i,m){
    cin>>a>>b;
    a--;
    b--;
    v[a]++;v[b]++;
  }
  rep(i,n){
    if(v[i] % 2 != 0){
      cout<<"NO"<<endl;
      return ;
    }
  }
  cout<<"YES"<<endl;

}

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


Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

vector<int> ZAlgo(const string &s) {
    vector<int> Z(s.size());
    Z[0] = s.size();
    int i = 1, j = 0;
    while(i < s.size()) {
        while (i + j < s.size() && s[j] == s[i + j]) j++;
        Z[i] = j;

        if (j == 0) {
            i++;
            continue;
        }
        int k = 1;
        while (k < j && k + Z[k] < j) {
            Z[i + k] = Z[k];
            k++;
        }
        i += k;
        j -= k;
    }
    return Z;
}

//--------------------------- Solve ---------------------------//

void solve() {
    int N; cin >> N;
    string s; cin >> s;

    int ans = 0;
    for (int i = 0; i < N; i++) {
        string t = s.substr(i);

        vector<int> z = ZAlgo(t);
        for (int j = 0; j < t.size(); j++) {
            if (j >= z[j]) ans = max(ans, z[j]);
        }
    }

    cout << ans << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3712
#include <stdio.h>

int main()
{
  double A = 100.0;
  long long int x;
  double X;
  int i;
  int j;
  long long int temp;
  scanf("%lf", &X);
  
  for(i = 1; /**/ ; ++i){
    A = 100.0;
    for(j = 0; j < i; ++j){
      A *= 1.01;
      temp = (long long int)A;
      A = (double)temp;
    }
    //printf("%lf, %lf\n", A, X);
    if(A >= X){
      printf("%d\n", i);
      return 0;
    }
  }
}

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

int main() {
	int n, k;
	cin >> n >> k;
	int x[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	int m = 300000000;
	for (int i = 0, t; i + k - 1 < n; i++) {
		if (x[i + k - 1] < 0) {
			t = abs(x[i]);
			m = min(m, t);
		} else if (x[i] < 0) {
			t = abs(x[i]) + x[i + k - 1] + min(abs(x[i]), x[i + k - 1]);
			m = min(m, t);
		} else {
			m = min(m, x[i + k - 1]);
			break;
		}
	}
	cout << m << endl;
}


Measured memory_bytes: 640
len_s = int(input())
s = [int(i) for i in input().split()]
len_t = int(input())
t = [int(i) for i in input().split()]
cnt = 0


for f in t:
    key = f
    lower_bound = 0
    upper_bound = len(s)-1
    found = False

    while lower_bound <= upper_bound and not found:
        middle_pos = (lower_bound + upper_bound) // 2

        if s[middle_pos] < key:
            lower_bound = middle_pos + 1
        elif s[middle_pos] > key:
            upper_bound = middle_pos - 1
        else:
            found = True
            cnt += 1

print(cnt)

Measured memory_bytes: 18936
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
 
int main(){
  string s,t;
  cin >> s >> t;

  cout << t+s << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#include<math.h>
#include<string.h>
#include<ctype.h>

	int main ()
	{

   int a,b,c,d,e,t,i,j,k,n,sum=0,mi=0 ;
   char ch ;
   float g,h ;
  char s[100001] ;
gets(s) ;
if(s[1]=='B')
    printf("ARC") ;
else
    printf("ABC") ;



		return 0;


	}


Measured memory_bytes: 1608
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits>
 
int main(){
 
    long N;
    std::cin >> N;
    N-=1;
    char T[1000];
    long count=0;
    while(1){
        T[count]='a'+(N%26);
        count++;
        N=N/26;
        if(N==0){
            break;
        }
        N-=1;
    }
    
    for(long i=count-1; i>=0; i--){
        std::cout << T[i];
    }
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 3608
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(1,n-1):
    if (p[i-1] < p[i] and p[i] < p[i+1]) or \
        (p[i-1] > p[i] and p[i] > p[i+1]):
        count += 1
print(count)

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

#define M 200005
#define MOD 1000000007
#define PI 3.14159265358979323846
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
typedef pair<lli,lli> PLL;

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

//    freopen("input.txt","r",stdin);

    int n;
    cin>>n;
    
    int ans = 0;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        if(i%2==1 && x%2==1)
            ans++;
    }
    
    cout<<ans<<"\n";
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
const int MAX=1e5+7;
int n;
int order[MAX];
int dish[MAX];
int addScore[MAX];
long long int ans;

int main() {
	cin>>n;
	for(int i=1; i<=n; i++) cin>>order[i];
	for(int i=1; i<=n; i++) cin>>dish[i];
	for(int i=1; i<=n-1; i++) cin>>addScore[i];
	for(int i=1; i<=n; i++) {
		ans+=dish[order[i]];
		if(order[i+1]-order[i]==1) ans+=addScore[order[i]];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

 int main(){

  int A,B,C;

  cin >> A >> B >> C;
  
  if (A == 1) cout << "No" << endl;
  
  else if (A == B && B ==C) cout << "Yes" << endl;
  
  else cout << "No" << endl;
  
 return 0;
}

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

int main(){
    int a[5];
    int k;
    for(int i = 0; i < 5; i++){
        cin >> a[i];
    }
    cin >> k;

    for(int i = 0; i < 5; i++){
        for(int j = i; j < 5; j++){
            //cout << a[i] - a[j] << endl;
            if(abs(a[i]-a[j]) > k){
                cout << ":(" << endl;
                return 0;

            }

        }
    }

    cout << "Yay!" << endl;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/03  Problem: ABC 120 D / Link: http://abc120.contest.atcoder.jp/tasks/abc120_d  ----- */
struct UnionFind {
	vector<int> data;
	UnionFind(int n) { data.assign(n, -1); }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
	int size(int x) { return -data[root(x)]; }
};


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

	LL N, M; cin >> N >> M;
	vector<LL> a(M), b(M);
	for (int i = 0; i < M; ++i) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
	}
	UnionFind uf(N);
	LL cnt = (N * (N - 1)) / 2;
	VL outs; {
		FORR(i, M - 1, 0 - 1) {
			outs.push_back(cnt);
			if (!uf.same(a[i], b[i])) {
				LL asz = uf.size(a[i]);
				LL bsz = uf.size(b[i]);
				cnt -= asz * bsz;
				uf.unionSet(a[i], b[i]);
			}
		}

	}

	
	reverse(ALL(outs));
	for (auto it : outs) {
		cout << it << endl;
	}

	return 0;
}


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

int main(){
  long A, B, K, n;
  cin >> A >> B >> K;

  A = A - K;
  n = B + A;
  
  if (A<0 && n>0){
    printf("0 %ld\n",n);
  }
  else if (n<=0){
    printf("0 0\n");
  }
  else {
    printf("%ld %ld\n",A,B);
  }
}


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

int main(){
  int n;cin>>n;
  vector<int>A(n,0);
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  sort(A.begin(),A.end());
  cout << A[n-1]-A[0]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[10010];
bool c,f; 
int main() {
    gets(a); 
    for(int i=0;i<strlen(a);i++) {
        if(a[i]=='C') c=true; 
        if(a[i]=='F'&&c==true) f=true;
    }
    if(f==true) cout<<"Yes"; 
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#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;

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


Measured memory_bytes: 3596
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
using namespace std;
typedef long long ll;
const int maxn=100+10,mo=1000000007;
int f[maxn][maxn][maxn],a[maxn];
int i,j,k,l,r,s,t,n,m,ans;
int main(){
	scanf("%d",&n);
	fo(i,1,2*n-1) scanf("%d",&a[i]);
	if (n==1){
		printf("1\n");
		return 0;
	}
	sort(a+1,a+2*n);
	t=1;
	if (a[n]!=a[n-1]) t++,l++;
	if (a[n]!=a[n+1]) t++;
	f[n-1][t][l]=1;
	fd(i,n-1,1)
		fo(j,0,2*n)
			fo(k,0,j-1)
				if (f[i][j][k]){
					t=r=0;
					if (i>1&&a[i-1]!=a[i]) t++,r++;
					if (i>1&&a[2*n-i+1]!=a[2*n-i]) t++;
					fo(l,1,k) (f[i-1][j-(k-l)+t][l-1+r]+=f[i][j][k])%=mo;
					(f[i-1][j+t][k+r]+=f[i][j][k])%=mo;
					fo(l,1,j-k-1) (f[i-1][j-(l-1)+t][k+r+1]+=f[i][j][k])%=mo;
				}
	fo(j,0,2*n)
		fo(k,0,2*n) (ans+=f[0][j][k])%=mo;
	(ans+=mo)%=mo;
	printf("%d\n",ans);
}

Measured memory_bytes: 3328
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

A = a % 10
B = b % 10
C = c % 10
D = d % 10
E = e % 10

L = []
if A != 0:
  L.append(10-A)
if B != 0:
  L.append(10-B)
if C != 0:
  L.append(10-C)
if D != 0:
  L.append(10-D)
if E != 0:
  L.append(10-E)
l = sorted(L)
s = len(l)
S = 0
for i in range(0, s-1):
  S += l[i]

total = a + b + c + d + e + S
print(total)




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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll x,x_=0,ans=0;cin>>x;
  ans+=2*(x/11);x-=11*(x/11);
  while(x_<x) {
    if (ans%2==0) x_+=6;else x_+=5;
    ans+=1;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  vector<ll> t(n);
  for(int i = 0;i < n;i++)cin >> t[i];
  sort(t.begin(),t.end());
  if(t[0] == 0){
    cout << 0 << endl;
    return 0;
  }
  vector<ll> num(2 * n);
  for(int i = 0;i < n;i++){
    num[i] = t[i];
    num[2 * n - i - 1] = 24 - t[i];
  }
  ll now = 0;
  now = 100;
  ll res = 0;
  ll mae = 0;
  //for(int i = 0;i < num.size();i++)cout << num[i] << " ";
  //cout << endl;
  for(int i = 0;i < 2 * n;i++){
    if(i % 2 == 0){
      now = min(now,num[i] - mae);
      mae = num[i];
    }
  }
  now = min(now,24 - num[2 * n - 2]);
  res = now;
  now = 100;
  mae = 0;
  for(int i = 0;i < 2 * n;i++){
    if(i % 2 == 1){
      now = min(now,num[i] - mae);
      mae = num[i];
    }
  }
  now = min(now,24 - num[2 * n - 1]);
  res = max(res,now);
  cout << res << endl;
}

Measured memory_bytes: 256
MX = 100005
n = int(input())
cnt = [0] * MX
a = list(map(int, input().split()))

for i in a:
    cnt[i] += 1

total = 0

for i in range(MX):
    total += i*cnt[i]

q = int(input())
b = []
c = []
 
for i in range(q):
    B, C = [int(i) for i in input().split()]
    b.append(B)
    c.append(C)

for i in range(q):
    total -= b[i]*cnt[b[i]]
    total -= c[i]*cnt[c[i]]
    cnt[c[i]] += cnt[b[i]]
    cnt[b[i]] = 0
    total += c[i]*cnt[c[i]]
    print(total)
    
    
    
    
    

Measured memory_bytes: 22964
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b)
#define chmin(a, b) (a)=min(a, b)
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

vector<ll> g[MAX];

int main(void) {
  ll i, j, k;

  ll X;
  cin >> X;
  
  for(i=-1000; i<1000; i++) {
    for(j=-1000; j<1000; j++) {
      if(pow(i, 5)-pow(j, 5)==X) {
        pt(i<<" "<<j);
        return 0;
      }
    }
  }
  
  
  
}
 


Measured memory_bytes: 6484
n = gets.to_i
# p n
s = gets.chomp.split('')
pre = []
s.each_with_index do |v,i|
  if v == "A" && s[i+1] == "B" && s[i+2] == "C"
    pre << i
  end
  # p v, i
end
puts pre.size

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

int main()
{
    int n;
    cin >> n;
    int c = n % 10;
    if ((c == 2) || (c == 4) || (c == 5) || (c == 7) || (c == 9))
        cout << "hon";
    else if (c == 0 || c == 1 || c == 6 || c == 8)
        cout << "pon";
    else
        cout << "bon";
}


Measured memory_bytes: 3624
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    int a[3][3];
    bool foo[3][3];
    for(int i=0;i<3;++i){   
        for(int j=0;j<3;++j){
            a[i][j]=in();
            foo[i][j]=false;
        }
    }

    int n=in();
    for(int i=0;i<n;++i){
        int b=in();
        for(int j=0;j<3;++j){
            for(int k=0;k<3;++k){
                if(a[j][k]==b){
                    foo[j][k]=true;
                }
            }
        }
    }

    bool ans=false;
    for(int i=0;i<3;++i)ans|=foo[i][0]&foo[i][1]&foo[i][2];
    for(int i=0;i<3;++i)ans|=foo[0][i]&foo[1][i]&foo[2][i];
    ans|=foo[0][0]&foo[1][1]&foo[2][2];
    ans|=foo[2][0]&foo[1][1]&foo[0][2];
    cout<<(ans?"Yes":"No")<<endl;
}


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

int main()
{
    int N;
    cin >> N;
    vector<int> cost(N+1);
    for(int i = 1 ; i <= N ;i++)
        cin >> cost[i];
    int INF = 1e6 + 5;
    vector<int>dp(N+1,INF);
    dp[1] = 0;

    for(int  i = 2 ; i <= N ; i++)
    {
        dp[i] = min (  dp[i-1]+abs(cost[i] - cost[i-1]) , dp[i-2]+abs(cost[i] - cost[i-2]));
    }

    cout << dp[N];
    return 0;


}

Measured memory_bytes: 3972