akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

#define CHUNK_SIZE 1024

struct array_t {
	int size;
	int* data[CHUNK_SIZE];
};

void init(struct array_t* t) {
	int i;
	t->size = 0;
	for (i = 0; i < CHUNK_SIZE; i++) t->data[i] = NULL;
}

void pushBack(struct array_t* t, int x) {
	if (t->data[t->size / CHUNK_SIZE] == NULL) {
		if ((t->data[t->size / CHUNK_SIZE] = malloc(sizeof(int) * CHUNK_SIZE)) == NULL) exit(1);
	}
	t->data[t->size / CHUNK_SIZE][t->size % CHUNK_SIZE] = x;
	t->size++;
}

void popBack(struct array_t* t) {
	if (t->size > 0) {
		t->size--;
		if (t->size % CHUNK_SIZE == 0) {
			free(t->data[t->size / CHUNK_SIZE]);
			t->data[t->size / CHUNK_SIZE] = NULL;
		}
	}
}

int get_at(const struct array_t* t, int idx) {
	if (idx < 0 || t->size <= idx) return 1145141919;
	return t->data[idx / CHUNK_SIZE][idx % CHUNK_SIZE];
}

void set_at(const struct array_t* t, int idx, int x) {
	if (0 <= idx && idx < t->size) {
		t->data[idx / CHUNK_SIZE][idx % CHUNK_SIZE] = x;
	}
}

void clear(struct array_t* t) {
	int i;
	t->size = 0;
	for (i = 0; i < CHUNK_SIZE; i++) {
		free(t->data[i]);
		t->data[i] = NULL;
	}
}

void adjust_heap(struct array_t* t, int pos) {
	int size = t->size;
	for (;;) {
		int c1 = pos * 2 + 1;
		int next = get_at(t, pos);
		int next_idx = pos;
		if (c1 < size && get_at(t, c1) > next) {
			next = get_at(t, c1);
			next_idx = c1;
		}
		if (c1 + 1 < size && get_at(t, c1 + 1) > next) {
			next = get_at(t, c1 + 1);
			next_idx = c1 + 1;
		}
		if (next_idx == pos) {
			if (pos == 0) break;
			pos = (pos - 1) / 2;
		} else {
			int tmp = get_at(t, pos);
			set_at(t, pos, next);
			set_at(t, next_idx, tmp);
			pos = next_idx;
		}
	}
}

void pq_insert(struct array_t* t, int x) {
	pushBack(t, x);
	adjust_heap(t, t->size - 1);
}

void pq_getMax(struct array_t* t) {
	if (t->size > 0) {
		printf("%d\n", get_at(t, 0));
	}
}

void pq_deleteMax(struct array_t* t) {
	if (t->size > 0) {
		set_at(t, 0, get_at(t, t->size - 1));
		popBack(t);
		adjust_heap(t, 0);
	}
}

struct array_t pq[1024];

int main(void) {
	int n, q;
	int i;
	if (scanf("%d%d", &n, &q) != 2) return 1;
	for (i = 0; i < n; i++) init(&pq[i]);
	for (i = 0; i < q; i++) {
		int query, t, x;
		if (scanf("%d%d", &query, &t) != 2) return 1;
		if (query == 0 && scanf("%d", &x) != 1) return 1;
		switch (query) {
			case 0:
				pq_insert(&pq[t], x);
				break;
			case 1:
				pq_getMax(&pq[t]);
				break;
			case 2:
				pq_deleteMax(&pq[t]);
				break;
		}
	}
	for (i = 0; i < n; i++) clear(&pq[i]);
	return 0;
}



Measured memory_bytes: 13676
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        char[] X = new char[200000];
        int N = in.read(X, 0, X.length);

        int ans = 0;
        int s = 0;
        for (int i = 0; i < N; i++) {
            if (X[i] == 'S') {
                s++;
            } else if (s > 0) {
                s--;
            } else {
                ans++;
            }
        }
        ans += s;
        
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


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

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

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

  char c;
  cin>>c;
  c++;
  if(c>'z'){
    c='a';
  }
  cout<<c<<endl;

  return 0;
}




Measured memory_bytes: 256
n, x = map(int, input().split())
a = [int(x) for x in input().split()]
b = [None] * n
for i, c in enumerate(a):
    b[i] = [None] * n
    b[i][0] = a[i]
    for j in range(1, n): b[i][j] = min(b[i][j - 1], a[(i - j) % n])
d = None
for i in range(n):
    c = i * x
    for j in range(n): c += b[j][i]
    if d is None or c < d:
        d = c
print(d)


Measured memory_bytes: 136028
#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++)

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



int main() {
    double L;
    cin >> L;

    double len = L / 3.0;

    cout << std::fixed << std::setprecision(9) << len*len*len << endl;
}


Measured memory_bytes: 256
import java.io.{BufferedReader, InputStreamReader}

object Main extends App {

  def isMatch(arr:Array[Char], t:String, k:Int):Boolean = {
    for(i <- 0 until t.length) {
      if(t.charAt(i) != arr(i+k) && arr(i+k) != '?')
        return false
    }
    true
  }
  def construct(arr:Array[Char], t:String, k:Int):Unit = {
      for(i <- 0 until t.length) {
        arr(i+k) = t.charAt(i)
      }
  }

  val in = new BufferedReader(new InputStreamReader(System.in))
  val s, t = in.readLine

  val ans = {
    val arr = s.toCharArray
    var isMatched = false

    for(i <- s.length - t.length to 0 by -1) {
      if(!isMatched) {
        if(isMatch(arr, t, i)) {
          construct(arr, t, i)
          isMatched = true
        }
      }
    }

    if(isMatched) {
      for(i <- 0 until s.length) {
        if(arr(i) == '?') {
          arr(i) = 'a'
        }
      }
      arr.mkString
    }
    else "UNRESTORABLE"
  }

  println(ans)
}

Measured memory_bytes: 26820
#include "bits/stdc++.h"
#define all(x) x.begin(),x.end()
#define rep(i,N) for(int i=0;i<(int)N;++i)
using namespace std;
using ll = long long;
using vint = vector<int>;
using vll = vector<ll>;
using vll2 = vector<vector<ll>>;
const ll INF = (1LL << 30);
const ll LINF = (1LL << 60);
const ll MOD = 1e9 + 7;

ll dp[2][2][5001];

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

   int N; cin >> N;
   vll t(N - 1);
   rep(i, N - 1) cin >> t[i];

   rep(i, 2) rep(j, 2) rep(k, 5001) dp[i][j][k] = LINF;
   dp[0][0][1] = dp[0][1][0] = 0;

   ll ans = LINF;
   for (int i = 1; i < N; ++i) {
      for (int j = 0; j <= N / 2; ++j) {
         if (j >= 1)
            dp[i & 1][0][j] = min({
            dp[i & 1][0][j],
            dp[(i - 1) & 1][0][j - 1],
            dp[(i - 1) & 1][1][j - 1] + t[i - 1] });
         dp[i & 1][1][j] = min({
            dp[(i - 1) & 1][0][j] + t[i - 1],
            dp[(i - 1) & 1][1][j] });
      }
      rep(k, 2) rep(j, N / 2 + 1) {
         dp[(i - 1) & 1][k][j] = LINF;
      }
   }

   cout << min(dp[(N - 1) & 1][0][N / 2], dp[(N - 1) & 1][1][N / 2]) << endl;
}


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

int n,a[31],b,c;

int main(){
  for(int i = 0; i <= 30; i++){
    a[i]=0;
  }
  for(int i = 0; i < 28; i++){
    cin >> n;
    a[n]=1;
  }
  for(int i = 1; i <= 30; i++){
    if(a[i]==0){
      if(b==0){
        b=i;
      }else{
        c=i;
      }
    }
  }
  cout << b << endl << c << endl;
  return 0;
}

Measured memory_bytes: 1160
n = int(input())
line = list(map(int, input().split()))

max = line[0]
min = line[0]
sum = line[0]

for i in range(1, n):
    if max < line[i]:
        max = line[i]
    elif min > line[i]:
        min = line[i]
    sum += line[i]

print(min, max, sum)


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int a, b, k;
    cin >> a >> b >> k;
    set<int> s;
    FOR(i, a, min(b, a + k - 1)) s.insert(i);
    FORd(i, b, max(a, b - k + 1)) s.insert(i);
    for(auto i : s) cout << i << "\n";
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> cnt(m);
  for (int i = 0; i < n; ++i) {
    int len;
    cin >> len;
    while (len--) {
      int x;
      cin >> x;
      cnt[x - 1]++;
    }
  }
  int ret = 0;
  for (int i = 0; i < m; ++i) {
    if (cnt[i] == n) ++ret;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    k, s = map(int, input().split())
    if s > 3*k:
        pass
    elif s == 3*k:
        ans = 1
    else:
        ans = 0
        for i in range(k+1):
            for j in range(k+1):
                    if 0<=s - (i + j)<=k:
                        ans += 1
    print(ans)
main()


Measured memory_bytes: 2940
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;

int main(){
    string s, t;
    cin >> s >> t;
    bool ans = false;
    for(int i = 0; i < s.size(); i++){
        if(s == t){
            ans = true;
            break;
        }
        s = s.back() + s.substr(0, s.size()-1);
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


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

using namespace std;

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

#define ALL(obj)	(obj).begin(),(obj).end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define VEC vector

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				Vint;
typedef vector<Vint>			VV;

template<typename T>string join(const v(T)&v)
{stringstream s;REP(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		400010

const ll LINF = (ll)9e18+7;		//
const int INF = 100100100;			//2,147,483,647 (Max int)
const ll MOD = 1e9+7;
// テンプレ終了
//====================================================================//

// int DP[MAX];

//
int main(){
	int N;cin>>N;
	string s;cin >> s;

	int ans = N;
	REPS(i,1,N){
		if(s[i]==s[i-1])ans--;
	}

	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 512
#include <iostream>

using namespace std;
using ll = long long;


int main() {
	ll s;
	cin >> s;

	cout << 0 << " " <<  0 << " " << 1 << " " << 1000000000 << " ";
	if (s < 1000000000) {
		cout << 0 << " " << s << endl; 
		return 0;
	}
	if (s % 1000000000 == 0) {
		cout << s / 1000000000 << " " << 0<< endl; 
		return 0;
	}
	ll x = s / 1000000000 + 1;
	ll y = 1000000000 - (s % 1000000000);
	cout << x << " " << y << endl; 



	return 0;
}

Measured memory_bytes: 256
N=int(input())
l=[input() for i in range(N)]
a_c=0
b_c=0
ab_c=0
ans=0
for i in l:
   ans+=i.count("AB")
   if i[0] == "B" and i[-1] == "A":
      ab_c+=1
      continue
   if i[-1] == "A":
      a_c+=1
   if i[0] == "B":
      b_c+=1
ans+=max(ab_c-1,0)
if a_c > 0 and ab_c>0:
   a_c-=1
   ans+=1
if b_c > 0 and ab_c>0:
   b_c-=1
   ans+=1
ans+=min(a_c,b_c)
print(ans)

Measured memory_bytes: 3700
#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
#define _rep(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
#define N 200005
#define ll long long
int n,k;
std::vector<int> v[N];
int main(){
	std::cin>>n>>k;
	rep(i,1,n){
		v[i%k].push_back(i);
	}
	ll ans=0;
	rep(i,0,k-1) if(i*2%k==0){
		if(v[i].empty()) continue;
		ll num=v[i].size();
		ans+=num*num*num;
	}
	std::cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 11296
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#define pb push_back
#define mp make_pair

int getint() {
	char C;
	while (!isdigit(C = getchar()));
	int x = C - '0';
	while (isdigit(C = getchar())) x = x * 10 + C - '0';
	return x;
}

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


	int N, Q;
	N = getint();
	Q = getint();
	char S[200000];
	rep(i, N) S[i] = getchar();
	char T[200000], D[200000];
	rep(i, Q) {
		getchar();
		T[i] = getchar();
		getchar();
		D[i] = getchar();;
	}
	int L = 0;
	int R = N;
	for (int i = Q - 1; i >= 0; i--) {
		if (R > 0 && D[i] == 'R' && S[R - 1] == T[i]) R--;
		else if (R < N && D[i] == 'L' && S[R] == T[i]) R++;
		if (L > 0 && D[i] == 'R' && S[L - 1] == T[i]) L--;
		else if (L < N && D[i] == 'L' && S[L] == T[i]) L++;
	}

	co(R - L);

	return 0;
}


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

using namespace std;
using LL = long long;

const int MAXN = 200010;

int N, K, A[MAXN];

bool check(LL v) {
    int KK = K;

    for (int i = 0; i < N; ++i) {
        KK -= ((A[i] + v - 1) / v - 1);
    }

    return KK >= 0;
}

void solver() {
    cin >> N >> K;
    for(int i = 0; i < N; ++i) cin >> A[i];

    LL L = 1, R = 1e9 +100, best = R;

    while(L <= R) {
        LL m = (L + R) / 2LL;
        if (check(m)) {
            best = m;
            R = m - 1;
        }
        else {
            L = m + 1;
        }
    }

    cout << best << '\n';
}

int main() {

    ios_base :: sync_with_stdio(0); cin.tie(NULL);

    int t;
    //cin >> t;
    t = 1;

    while(t--)
        solver();

    return 0;
}

Measured memory_bytes: 4364
#!/usr/bin/env pypy3

from sys import stdin, stdout
 
def input():
    return stdin.readline().strip()

N, D = input().split()
N = int(N)
D = int(D)
DD = D**2
ret = 0
for _ in range(N):
	x, y = input().split()
	x = int(x)
	y = int(y)
	dd = x*x + y*y
	if dd <= DD:
		# print(x, y)
		ret += 1
print(ret)

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

int main() {
	int a, b, c;
	
	scanf("%d %d %d", &a, &b, &c);
	
	a = b - a;
	b = c - b;
	
	if (a < 0) a *= 1;
	if (b < 0) b *= 1;
	
	printf("%s", a == b ? "YES" : "NO");
	return 0;
}

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

int main() {
  string s,t;
  cin >> s >> t;
  int count = 0;
  
  for(int i = 0; i < s.size(); i++){
    if(s.at(i)!=t.at(i)){
      count++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 3856
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using D = double;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_num(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define RALL(qpqpq)           (qpqpq).rbegin(),(qpqpq).rend()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int w, h;
char c;

int main() {
	cin >> w >> h >> c;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if ((i == 1 || i == h) && (j == 1 || j == w)) {
				cout << '+';
			}
			else if (i == 1 || i == h) {
				cout << '-';
			}
			else if (j == 1 || j == w) {
				cout << '|';
			}
			else if (i == h / 2 + 1 && j == w / 2 + 1) {
				cout << c;
			}
			else {
				cout << '.';
			}
		}
		cout << endl;
	}
	//system("pause");
}


Measured memory_bytes: 3120
//file_name:ABC81_A.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


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


    ll ans = 0;
    rep(i,3){
        if(s[i]=='1')ans++;
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
S = list(input())
n = [int(s) for s in S]
#print(n)

ans = []

def dfs(a, b, c):
  if c == len(n)-1:
    if b == 7:
      ans.append(a + '=7')
    return
  dfs(a + '+' + S[c+1], b + n[c+1], c+1)
  dfs(a + '-' + S[c+1], b - n[c+1], c+1)
  
dfs(S[0], n[0], 0)

print(ans[0])


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

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

int main(){
    int n;
    cin >> n;
    ll lcm;
    cin >> lcm;
    rep(i, n-1){
        ll val;
        cin >> val;
        lcm = lcm / gcd(lcm, val) * val;
    }
    cout << lcm << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);
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; }

int main() {

    int N, M, K;
    cin >> N >> M >> K;
    
    for(int i = 0; i <= N; i++) {
        for(int j = 0; j <= M; j++) {
            if ((M-j)*i + (N-i)*j == K) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    
    // cout << ans << endl;
    return 0;
}

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

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

    return gcd(b, a%b);
}

long long lcs(long long a, long long b){
    return a*b/gcd(a, b);
}

int main(){
    long long x;
    cin >> x;
    long long l = lcs(x, 360);

    cout << l/x << endl;
    return 0;
}

Measured memory_bytes: 3560
a = input()
b = input()
#print(b)
def rec(a,b,c):
    if c==len(b)+1:
        return False
    if b == a:
        return True
    newb = b[len(b)-1]+b[0:-1]
    c+=1
    return rec(a,newb,c)
    

if rec(a,b,0):
    print("Yes")
else:
    print("No")
    

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
 	ios_base::sync_with_stdio(false);
	cin.tie(0);
 	string s;
 	cin>>s;
 	for(int i=0;i<s.size();i++)
 	{
 		cout<<'x';
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main(){
    double t,x; cin >> t >> x;
    cout << t/x << endl;
    return 0;
}


Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

ans=0
x,y=LI()
m=[0]*10000
m[1]=3
m[2]=2
m[3]=1
#m={1:3,2:2,3:1}
if x==y==1:
    ans=10
else:
    ans=m[x]+m[y]
#for i in range(n):
    
print(ans*10**5)

Measured memory_bytes: 38740
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  int i,j,k;
  int n;
  cin>>n;
  vector<int> f(n),a(n),t(n),x(n),y(n);
  rep(i,n)
    cin>>f[i]>>a[i]>>t[i]>>x[i]>>y[i];
  pii re[2]={pii(-1,-324444),pii(-1,-324444)};
  rep(i,n-1){
    if(t[i]!=t[i+1] || a[i]==a[i+1])continue;
    ll dx=x[i]-x[i+1],dy=y[i]-y[i+1];
    re[t[i]]=max(re[t[i]],pii(dx*dx+dy*dy,-f[i+1]+f[i]));
  }
  rep(i,2){
    if(re[i].X<0)
      cout<<"-1 -1"<<endl;
    else
      cout<<sqrt(re[i].X)<<" "<<-1.*re[i].Y/60<<endl;
  }
  return 0;
}

Measured memory_bytes: 1280
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
namespace AtCoder {
    class MainClass {
        public static void Main(string[] args) { new MainClass().solve(); }

        Scanner cin = new Scanner();


        int a, b, c;
        void solve() {
            a = cin.nextInt();
            b = cin.nextInt();
            c = cin.nextInt();

            HashSet<int> hs = new HashSet<int>();

            hs.Add(a);
            hs.Add(b);
            hs.Add(c);

            int ans = hs.Count();

            Console.WriteLine(ans);

        }
        class Scanner {
            string[] nextBuffer; int BufferCnt; char[] cs = new char[] { ' ' };
            public Scanner() { nextBuffer = new string[0]; BufferCnt = 0; }
            public string next() {
                if (BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();
                nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                BufferCnt = 0;
                return nextBuffer[BufferCnt++];
            }
            public int nextInt() { return int.Parse(next()); }
            public long nextLong() { return long.Parse(next()); }
            public double nextDouble() { return double.Parse(next()); }
        }
        class Mathf {
            private int mod = 1000000007;//10^9+7
            public int Mod { get; set; }
            public Mathf() { }
            public Mathf(int mod) { this.mod = mod; }
            public long Pow(long a, long b) {
                if (b == 0) return 1;
                if (b % 2 == 1) return (a % mod * Pow(a % mod, b - 1) % mod) % mod;
                else return Pow(a * a % mod, b / 2) % mod;
            }
            public long Fact(long n) { return n != 0 ? (n % mod * (Fact(n - 1) % mod) % mod) : 1; }
            public long C(long n, long r) {if (r == 0 || n == r) return 1;
                else return (Fact(n) % mod * Pow((Fact(n - r) % mod * Fact(r) % mod) % mod, mod - 2) % mod) % mod;}
        }
    }
}

Measured memory_bytes: 13396
#include <stdio.h>

int main()
{
    int n,x,i,j,k;
    int c = 0;

    while (1) {
      scanf ("%d %d",&n,&x);

      if (n == 0 && x ==0) {
        break;
      }

    for (i = 1; i <= n; i++) {
      for (j = i+1; j <= n; j++) {
        for (k = j+1; k <= n; k++) {
          if (x == i + j + k) {
            c++;
          }
         }
       }
    }
     
    printf ("%d\n",c);
    c = 0;
    }
    
    return 0;
} 

Measured memory_bytes: 600
# N人のすぬけ君,K種類のお菓子
n,k = gets.chomp.split(" ").map(&:to_i)

# お菓子を持っているすぬけ君のリスト
a = []

k.times do
	di = gets.to_i
  	ai = gets.chomp.split(" ").map{|x| x.to_i}
	a += ai
end

# すぬけ君の人数から、お菓子を持っているすぬけ君の種類を引く
print n - a.uniq.length

Measured memory_bytes: 17516
#include <iostream>
using namespace std;
int main(){
    char C[2][3];
    for(int i=0; i<2; i++)
        for(int j=0; j<3; j++)
            cin >> C[i][j];

    for(int i=0; i<3; i++){
        if(C[0][i]!=C[1][2-i]){
            cout<<"NO\n";
            return 0;
        }
    }
    cout<<"YES\n";
    return 0;
}


Measured memory_bytes: 256
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;



int main(){
int N,K;
ll R,S,P;
string T;
cin>>N>>K>>R>>S>>P>>T;
string W="";
rep(i,N){
    if(T[i]=='r'){
        W+=string(1,'p');
    }
    else if(T[i]=='s'){
        W+=string(1,'r');
    }
    else{
        W+=string(1,'s');
    }
}
ll ans=0;
rep(i,N){
    if(W[i]=='r'){
        ans+=R;
    }
    else if(W[i]=='s'){
        ans+=S;
    }
    else{
        ans+=P;
    }
}
rep(i,N-K){
    if(W[i]==W[i+K]){
        W[i+K]='?';
        if(W[i]=='r'){
            ans-=R;
        }
        else if(W[i]=='s'){
            ans-=S;
        }
        else{
            ans-=P;
        }
    }
}
cout<<ans<<endl;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()

int main(){
  int n,ans=0;
  cin >> n;
  vi a(n);
  rep(i,n)  cin >> a[i];

  rep(i,n){
    while(a[i]%2==0){
      a[i]/=2;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
/*  .　　∧_∧
   　（ ´・ω・)
   　//＼￣￣旦＼
   ／/ ※ ＼＿＿＿＼
   ＼＼ 　※ 　※ 　※ ヽ
   　 ＼ヽ-＿_＿--＿__ヽ*/

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define vvsort(v) sort(v.begin(),v.end(),greater<int>());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
typedef priority_queue<int> pq;
typedef priority_queue<int,vector<int>,greater<int> > rpq;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
const double PI=acos(-1.0);
//-------------------------------------------------------------------------------------------------------------------------------------------//

int main(){
	ll s,c;
	cin>>s>>c;
	if(s*2>c){
		cout<<c/2<<endl;
		return 0;
	}
	s=s*2;
	ll con;
	con=(ll)((s+c)/(ll)4);
	cout<<con<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;

int main(){
    int n,k,q;
    cin>>n>>k>>q;
    int score[n];
    for (int j=0;j<=n;j++){
        score[j]=0;
    }
    int a;
    for(int i=0;i<q;i++){
        cin>>a;
        score[a]++;
    }
    for(int s=1;s<=n;s++){
        if(k-(q-score[s])<=0){
            cout<<"No\n";
        }
        else cout<<"Yes\n";
    }
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;

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

int main() {
  int n;cin >> n;
  vector<ll> a(n+1);
  a[0] = 0;
  for(int i=0;i<n;++i) cin >> a[i+1];
  vector<ll> l(n+2),r(n+2),m(n);
  l[0] = 0;
  r[n+1] = 0;
  for(int j=0;j<n+1;++j){
    l[j+1] = gcd(l[j],a[j]);
    r[n-j] = gcd(r[n-j+1],a[n-j]);
  }
  for(int j=1;j<n+1;++j){
    m[j-1] = gcd(l[j], r[j+1]);
  }
  auto max_itr = max_element(all(m));
  cout << *max_itr << endl;
  return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C,F,G=0,H=0,I=0;
    cin >> A >> B >> C;
    vector<int>D(B),E(B);
    for(int i=0;i<B;i++)cin >> D[i];
    for(int i=0;i<A;i++){
        for(int j=0;j<B;j++)cin >> E[j];
        for(int j=0;j<B;j++)G+=D[j]*E[j];
          if(G+C>0)H++;
          G=0;
    }
    cout << H << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


string S;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	int cur=0;
	int ma=0;
	cin>>S;
	FORR(s,S) {
		if(s=='A' || s=='T' || s=='C' || s=='G') cur++;
		else cur=0;
		ma=max(ma,cur);
	}
	cout<<ma<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int x,n,cur=1e9,ans=-1;
    cin >> x >> n;
    map<int,int> p;
    rep(i,n){
        int a;
        cin >> a;
        p[a]++;
    }
    rep(i,102){
        if(p[i]) continue;
        if(abs(x-i) < cur){
            cur = abs(x-i);
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3640
import java.util.*;
 
public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
 
        String s = stdIn.next();
        char c[] = s.toCharArray();
        
        int quo = (s.length() - 1) / 2;
        
        String s1 = s.substring(0, quo);
        char c1[] = s1.toCharArray();
        
        //System.out.println(s1);//
        
        String s2 = s.substring((s.length() + 3) / 2 - 1, s.length());
        char c2[] = s2.toCharArray();
        
        //System.out.println(s2);//
        
        boolean flag = true;
        
        if(flag){
            for(int i = 0; i < s.length() / 2; i++){
                if(c[i] != c[s.length() - 1 - i]){
                    flag = false;
                    break;
                }
            }
        }
        
        //System.out.println(flag);//
        
        if(flag){
            for(int i = 0; i < s1.length() / 2; i++){
                if(c1[i] != c1[s1.length() - 1 - i]){
                    flag = false;
                    break;
                }
            }
        }
        
        //System.out.println(flag);//
        
        if(flag){
            for(int i = 0; i < s2.length() / 2; i++){
                if(c2[i] != c2[s2.length() - 1 - i]){
                    flag = false;
                    break;
                }
            }
        }
        
        

        //int c = stdIn.nextInt();
        //int x = stdIn.nextInt();
        
        
        
        
        // for(int i = 0; i < s.length(); i++){
        //     a[i] = c[i] - 48;
        //     System.out.println(a[i]);
        // }
        //int sum = 0;
        //boolean flag = true;
        //for(int i = 0; i < s.length(); i++){
        //}
        
        if(flag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
 
        //System.out.println();
        //System.out.print();
 
        stdIn.close();
    }
}

Measured memory_bytes: 23764
import java.io.*;

public class Main {
	public static void main(String[] a) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[] Hills = new int[10];
		for (int i = 0; i < Hills.length; i++) {
			Hills[i] = Integer.parseInt(br.readLine());
		}
		int no1=0;
		int no2=0;
		int no3=0;
		
		for(int buf:Hills){
			if(no1<buf){
				no3=no2;
				no2=no1;
				no1=buf;
			}
			else if(no2<buf){
				no3=no2;
				no2=buf;
			}
			else if(no3<buf){
				no3 = buf;
			}
		}
		
		System.out.println(no1+"\n"+no2+"\n"+no3);

	}
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1000000007;

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pii> a(n);
	reps(i,n){
		cin >> a[i-1].first;
		a[i-1].second = i;
	}
	sort(all(a));
	rep(i,n){
		cout << ((i == 0) ? "" : " ") << a[i].second;
	}
	cout << '\n';
	return 0;
}


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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

#define mygc(c) (c)=getchar_unlocked()

int ri() {
	int c,s=0,r=0;
	for(;;){ mygc(c); if(c=='-'){s=1;break;} if(c<='9'&&c>='0'){r=c-'0';break;}}
	for(;;){ mygc(c); if(c>'9'||c<'0')break; r= r* 10 + c-'0';}
	if(s)r=-r;
	return r;
}

int main() {
    int n = ri();
	int a[n];
	FOR(i,n) a[i] = ri();
	
	int res = 0;
	FOR(i,n) {
		if (a[i] == i+1) {
			res++;
			i++;
		}
	}
	
	cout << res << endl;
    return 0;
}


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

using namespace std;
int main(){
    int n=1;
    while (true){
        cin >> n;
        if(n==0) break;
        vector<int> a(n);
        for (int i = 0 ;i<n;i++){
            cin >> a[i];
         }
        sort(a.begin(),a.end());
        int sum=0;
        for (int i=1;i<n-1;i++){
            sum+=a[i];
        }
        cout << sum /(n-2)<<endl;
    }
}

Measured memory_bytes: 3060
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for n in range(N):
    A = list(map(int,input().split()))
    a = 0
    for m in range(M):
        a += A[m]*B[m]
    a += C
    if a > 0:
        ans += 1
print(ans)


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

using namespace std;


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

	if (N[0] == N[1]&&N[0]==N[2])
		cout << "Yes" << endl;
	else if(N[1] == N[2] && N[1] == N[3])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define bitget(a, b) (((a) >> (b)) & 1)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vsort(x) sort(x.begin(), x.end())

using int32 = int_fast32_t;
using int64 = int_fast64_t;
using uint32 = uint_fast32_t;
using uint64 = uint_fast64_t;

using namespace std;

int main() {
	int x, y;
	cin >> x >> y;
	int ans = 0;
	int ax = abs(x);
	int ay = abs(y);
	ans = abs(ax - ay);
	if (ax>ay){
		ans += (x > 0);
		ans += (y > 0);
	}
	else if(ax<ay){
		ans += (x < 0);
		ans += (y < 0);
	}
	else{
		ans += (x != y);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main(): 
    N,M = map(int,input().split())
    A=list(map(int,input().split()))
    BC=[list(map(int,input().split())) for _ in range(M)]
    A.sort()
    BC.sort(key=lambda x: x[1], reverse=True)
    j=0
    i=0
    while j < M:
        while i < N:
            if BC[j][0] == 0: break
            if A[i] < BC[j][1]:
                A[i] = BC[j][1]
                BC[j][0]-=1
                i+=1
            else:
                break
        j+=1

    print(sum(A))
if __name__ == "__main__":
    main()
    

Measured memory_bytes: 74672
# coding: utf-8
# Your code here!
n=int(input())
s=list(input())
ans=["A","B","C"]
count=0
for i in range(n-2):
    cnt=0
    for j in range(len(ans)):
        if s[i+j]==ans[j]:
            cnt+=1
    if cnt ==3:
        count+=1
print(count)

Measured memory_bytes: 9100
N, M = map(int, input().split())

A = list(set(map(int, input().split(" "))))
G = A.copy()
 
while not any(x % 2 for x in G):
    G = [i // 2 for i in G]
 
if not all(x % 2 for x in G):
    print(0)
    exit(0)
    
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    return a * b // gcd(a, b)
    
total = 1

for x in A:
    total = lcm(total, x // 2)

print((M // total + 1) // 2)


Measured memory_bytes: 11356
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <stdio.h>
using namespace std;

int main(){
    int i,ans=0;
    string S,T;
    cin>>S>>T;
    for(i=0;i<3;i++){
        if(S.at(i)==T.at(i)){
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256