akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int ms = 1e5+9;
int dp[ms][3], n;
int activity[ms][3];


int main(){

  cin >> n;
  for(int i = 0; i < n ; i++){
    for(int j = 0; j < 3; j++) cin >>activity[i][j];
  }

  int ans = 0;


  for(int i = 0; i < n; i++){
    for(int j = 0; j < 3; j++){
      dp[i][j] += activity[i][j];
      int next_pos = (j+1)%3;
      dp[i+1][next_pos] = max( dp[i+1][next_pos], dp[i][j]);
      next_pos = (next_pos + 1)%3;
      dp[i+1][next_pos] = max(dp[i+1][next_pos], dp[i][j]);
    }
  }

  for(int i = 0; i <3; i++)
    ans = max(dp[n][i], ans);


  cout<<ans;


}

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

int main(){
  int N,K,ans;
  long long Y;
  ans=0;
 cin>>N;
  K=N;
for(int i=0;i<1000000;i++){
if(K>0){
  ans+=K%10;
  K/=10;
}
  else{
      break;
  }
}
  if(N%ans==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define BOOST ios_base :: sync_with_stdio(false), cin.tie(NULL), cout.tie(0)
#define fo(i,a,n) for(int i=a;i<n;i++)
#define fc(i,a,n,c) for(int i=a;i<n;i+=c)
#define fi(i,n,a) for(int i=n-1;i>=a;i--)
#define in cin>>
#define out cout<<
#define ll long long
#define el <<"\n"
#define es <<" "

int main(){
  int a,c=0,d=0;
  in a;
  int b[a];
  fo(i,0,a){
    in b[i];
    if(b[i]%2==0){
      if(b[i]%3==0 || b[i]%5==0)  d++;
      c++;
    } 
  }
  if(c==d)  out "APPROVED";
  else out "DENIED";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[102][100004];
ll prefix[102][100004];
ll m=1e9+7;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll a[n+1];
	for (ll i=1;i<=n;i++)
		cin>>a[i];
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	memset(prefix,0,sizeof(prefix));
	for (ll i=1;i<=k;i++)
		dp[0][i]=0;
	for (ll i=1;i<=n;i++)
	{
		for (ll r=0;r<=k;r++)
			{
				if (r==0)
					prefix[i-1][r]=(dp[i-1][0])%m;
				else
					prefix[i-1][r]=(prefix[i-1][r-1]%m+dp[i-1][r]%m)%m;
			}
		for (ll j=0;j<=k;j++)
		{
			if (j-a[i]-1>=0)
			dp[i][j]=(dp[i][j]%m+(prefix[i-1][j]%m-prefix[i-1][j-a[i]-1]%m+m))%m;
			else
				dp[i][j]=(dp[i][j]%m+prefix[i-1][j]%m)%m;

			prefix[i][j]=prefix[i][j-1]+dp[i][j];
		}
	}
	cout<<dp[n][k]%m;
}

Measured memory_bytes: 159616
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($a,$b) = explode(" ",trim(fgets(STDIN)));
//$a = explode(" ",trim(fgets(STDIN)));
//$a = array_map('intval',explode(" ",trim(fgets(STDIN))));

if ($a >= $b) {
  printf("%s\n",str_pad("",$a,$b,STR_PAD_LEFT));
}
else {
  printf("%s\n",str_pad("",$b,$a,STR_PAD_LEFT));
}


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

int median_l(vector<int> &v)
{
    size_t n = v.size() / 2 - 1;
    nth_element(v.begin(), v.begin()+n, v.end());
    return v[n];
}

int median_r(vector<int> &v)
{
    size_t n = v.size() / 2;
    nth_element(v.begin(), v.begin()+n, v.end());
    return v[n];
}

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

  vector<int> v(N);
  vector<int> v2(N);

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

  v2 = v;
  
  int l = median_l(v2);
  int r = median_r(v2);
  int ans;
  for ( int i = 0; i < N; i++ ){
    if ( r == l ){
      ans = r;
    } else {
      if ( v[i] <= l ){
        ans = r;
      } else {
        ans = l;
      }
    }
    cout << ans << endl;
  }
   

	return 0;
}


Measured memory_bytes: 3712
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

alias Node = Tuple!(int, "v", int, "c", int, "cost");

enum inf = 1<<30;
int n, m;
int[int][] dist;
Node[][int][] adj;

void main() {
    scan(n, m);
    dist = new int[int][](n);
    foreach (i ; 0 .. n) {
        dist[i][0] = inf;
    }
    adj = new Node[][int][](n);
    foreach (i ; 0 .. m) {
        int pi, qi, ci;
        scan(pi, qi, ci);
        pi--, qi--;
        dist[pi][ci] = inf;
        dist[qi][ci] = inf;
        adj[pi][ci] ~= Node(qi, ci, 0);
        adj[qi][ci] ~= Node(pi, ci, 0);
    }
    foreach (i ; 0 .. n) {
        foreach (c ; adj[i].keys) {
            if (c == 0) continue;
            adj[i][0] ~= Node(i, c, 1);
            adj[i][c] ~= Node(i, 0, 0);
        }
    }

    debug {
        writeln(adj);
    }

    alias Vet = Tuple!(int, "v", int, "c", int, "d");
    auto bh = new BinaryHeap!(Array!Vet, "a.d > b.d")();
    dist[0][0] = 0;
    bh.insert(Vet(0, 0, 0));

    while (!bh.empty) {
        auto v = bh.front;
        bh.removeFront;

        if (v.d > dist[v.v][v.c]) continue;

        if (v.v == n - 1) {
            writeln(v.d);
            return;
        }

        if (v.c !in adj[v.v]) continue;
        
        foreach (u ; adj[v.v][v.c]) {
            if (dist[u.v][u.c] > v.d + u.cost) {
                dist[u.v][u.c] = v.d + u.cost;
                bh.insert(Vet(u.v, u.c, dist[u.v][u.c]));
            }
        }
    }

    writeln(-1);
}





void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 122876
import java.io.IOException;
import java.util.Scanner;

public class Main {

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

		Scanner in = new Scanner(System.in);
		// ?????¢?????????????????????????????°???????´?????????????
		int[] char_count = new int[26];

		while(in.hasNextLine()){

			String str = in.nextLine();

			if(str.length() == 0){
			//if(str.equals("")){

				break;

			}else{

				// ???????????¨????°????????????????
				String lower_case = str.toLowerCase();


				// ???????????????????????????
				for (int i = 0; i < lower_case.length(); i++) {

					int array_number = 0;

					for(char a = 'a'; a <= 'z'; a++) {

						if(lower_case.charAt(i) == a){

							char_count[array_number]++;

							break;

						}

						array_number++;

					}

					/*if(lower_case.charAt(i) == 'a'){

						char_count[0]++;

					}else if(lower_case.charAt(i) == 'b'){

						char_count[1]++;

					}else if(lower_case.charAt(i) == 'c'){

						char_count[2]++;

					}else if(lower_case.charAt(i) == 'd'){

						char_count[3]++;

					}else if(lower_case.charAt(i) == 'e'){

						char_count[4]++;

					}else if(lower_case.charAt(i) == 'f'){

						char_count[5]++;

					}else if(lower_case.charAt(i) == 'g'){

						char_count[6]++;

					}else if(lower_case.charAt(i) == 'h'){

						char_count[7]++;

					}else if(lower_case.charAt(i) == 'i'){

						char_count[8]++;

					}else if(lower_case.charAt(i) == 'j'){

						char_count[9]++;

					}else if(lower_case.charAt(i) == 'k'){

						char_count[10]++;

					}else if(lower_case.charAt(i) == 'l'){

						char_count[11]++;

					}else if(lower_case.charAt(i) == 'm'){

						char_count[12]++;

					}else if(lower_case.charAt(i) == 'n'){

						char_count[13]++;

					}else if(lower_case.charAt(i) == 'o'){

						char_count[14]++;

					}else if(lower_case.charAt(i) == 'p'){

						char_count[15]++;

					}else if(lower_case.charAt(i) == 'q'){

						char_count[16]++;

					}else if(lower_case.charAt(i) == 'r'){

						char_count[17]++;

					}else if(lower_case.charAt(i) == 's'){

						char_count[18]++;

					}else if(lower_case.charAt(i) == 't'){

						char_count[19]++;

					}else if(lower_case.charAt(i) == 'u'){

						char_count[20]++;

					}else if(lower_case.charAt(i) == 'v'){

						char_count[21]++;

					}else if(lower_case.charAt(i) == 'w'){

						char_count[22]++;

					}else if(lower_case.charAt(i) == 'x'){

						char_count[23]++;

					}else if(lower_case.charAt(i) == 'y'){

						char_count[24]++;

					}else if(lower_case.charAt(i) == 'z'){

						char_count[25]++;

					}*/
				}
			}
		}
		// ??¢????????????????????????????????????????????¨?????°?????¨???
		char a = 'a';

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

			System.out.println(a++ + " : " + char_count[i]);

		}
	}
}

Measured memory_bytes: 26228
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 a;
  string s;
  cin >> a >> s;
  if (3200 <= a)
    cout << s << endl;
  else
    cout << "red" << endl;
  return 0;
}


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

public class Hello
{
    public static void Main()
    {
        
        string s = Console.ReadLine();
       
        
        var list1 = new List<int>();
       
        for (int i = 0; i < s.Length; i++)
        {
           int num = int.Parse(s[i].ToString());
           list1.Add(num);
        }
        
        
        int count0 = 0;
        int count1 = 0;
        for(int i = 0; i < list1.Count; i++)
        {
            if(list1[i] == 0) count0++;
            else if(list1[i] == 1) count1++;
        }
        if(count1 >= count0) Console.WriteLine(2 * count0);
        else Console.WriteLine(2 * count1);
        
    }
}


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

int main(){
    int N, K;
    string S;
    cin >> N >> S >> K;
    for (int i = 0; i < N; i++) {
        if (S[i] != S[K-1]) S[i] = '*';
    }
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		while (sc.hasNextLine()) {
			double d = Double.parseDouble(sc.nextLine());
			
			double sum = d;
			for (int i = 0; i < 4; i++) {
				d = d * 2;
				sum = sum + d;
				
				d = d / 3;
				sum = sum + d;
			}
			d = d * 2;
			sum = sum + d;
			
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 26204
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi                  3.14159265359
ll INF=1e18+10;
ll MOD=1000000009;

const int N=2*1e5+10;
bool vis[N];

int main()
{
    fastio;
    int n;cin>>n;
    int a[n+1];
    for(int i=0;i<n;i++)
    cin>>a[i+1];

    for(int i=n;i>0;i--)
    {
        int last=(n/i)*i;
        int c=0;
        for(int j=last;j>0;j-=i)
            if(vis[j]==1)c++;
        if((c%2==0 && a[i]==0) || (c%2==1 && a[i]==1))
            continue;
        else
            vis[i]=1;
    }
    vector<int> v;
    for(int i=1;i<=n;i++)
        if(vis[i])
        v.push_back(i);

    int siz=v.size();
    cout<<siz<<endl;
    for(int i=0;i<siz;i++)
        cout<<v[i]<<" ";
}


Measured memory_bytes: 2552
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

int main()
{
	ll n, m;
	ll *d, *t;

	cin >> n;
	d = new ll[n];
	for (ll i = 0; i < n; i++) {
		cin >> d[i];
	}

	cin >> m;
	t = new ll[m];
	for (ll i = 0; i < m; i++) {
		cin >> t[i];
	}

	sort(d, d + n);
	sort(t, t + m);

	ll pos = 0;
	bool flug = true;
	for (ll i = 0; i < m;) {
		if (t[i] == d[pos]) {
			i++;
			pos++;
		}
		else if(d[pos]<t[i]){
			pos++;
			if (pos == n) {
				flug = false;
				break;
			}
		}
		else {
			flug = false;
			break;
		}
	}

	if (flug) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}

	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main(void) {
   set<int> st1;
   set<int> st2;
   set<int> result;
   int n,a,m,b;
   cin >> n;
   for (int i=0;i<n;i++) {
       cin >> a;
       st1.emplace(a);
   }
   cin >> m;
   for (int j=0;j<m;j++) {
       cin >> b;
       st2.emplace(b);
   }
   set_intersection(st1.begin(),st1.end(),st2.begin(),st2.end(),inserter(result,result.end()));
   auto itr1 = result.begin();
   auto itr2 = result.end();
   for (itr1;itr1!=itr2;++itr1) {
       cout << *itr1 << endl;
   }
}



Measured memory_bytes: 23696
import java.text.*;import java.util.*;class Main{public static void main(String[]z){ChoiceFormat f = new ChoiceFormat("0#3|0.2#2|0.6#1|1.1#0");int[][]c=new int[4][2];for(Scanner s=new Scanner(System.in);s.hasNext();++c[new Integer(f.format(s.nextFloat()))][1])++c[new Integer(f.format(s.nextFloat()))][0];for(int[]b:c)System.out.println(b[0]+" "+b[1]);}}

Measured memory_bytes: 12000
function Main(input) {
	input = input.split("\n");
	a = input[1].split(" ");
	
	var n = parseInt(input[0], 10);
	
	for (var i = 0; i < n; i++) {
	a[i] = parseInt(a[i], 10);
	}
	
	var b = [];
	b[0] = 0;
	
	for (var i = 1; i < n; i++) {
	if  (a[i - 1] + b[i - 1] - a[i] < 0) {
	b[i] = 0;
	} else {
	b[i] = a[i - 1] + b[i - 1] - a[i];
	}
	}
	var sum = 0;
	for (var i = 0; i < n; i++) {
	sum += b[i];
	}
	console.log(sum);
	}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

long long n,k; cin>>n>>k;
long long arr[n];
for(int i=0; i<n;i++)
    cin>>arr[i];

    sort(arr,arr+n,greater<>());
for(int i=0; i<k&&i<n; i++)
{
    arr[i]=0;
}
long long sum=0;
for(int i=0; i<n; i++)
{
    sum+=arr[i];
}
cout<<sum<<endl;


return 0;
}


Measured memory_bytes: 1792
A, B = map(int, input().split())
C = []
for i in range(2,14):
  C.append(i)
C.append(1)

if C.index(A) < C.index(B):
  print("Bob")
elif C.index(A) == C.index(B):
  print("Draw")
else:
  print("Alice")

Measured memory_bytes: 61540
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
using namespace std;
int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	unsigned long l1=2,l2=1,l=3;
	if (N == 1){
		l = l2;
	}else{
		for (int i = 0; i <= N-2; ++i){
			l=l1+l2;
			l1=l2;
			l2=l;
		}
	}
	cout << l << endl;
}

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

int main(){
	string str;
	while(getline(cin,str)&&str!="0"){
		int ans=0,one=0;
		for(int i=0;i<str.size();i++){
			if(str[i]!=' '){
				if(str[i]=='1'){
					if(str[i+1]>='0'){
						ans+=10;
						i++;
					}
					else one++,ans++;
				}
				else ans+=str[i]-'0';
			}
		}
		for(int i=0;i<one;i++){
			if(ans+10<22)ans+=10;
		}
		if(ans>21)ans=0;
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
import sys
n = 3

c = [[-1,-1,-1] for _ in range(n)]
for i in range(n):
  c[i] = list(map(int,input().split()))
  
#print(c)

Flag = True
if c[1][0]-c[0][0] != c[1][1]-c[0][1] or c[1][0]-c[0][0] != c[1][2]-c[0][2]:
  print("No")
  sys.exit()
if c[2][0]-c[0][0] != c[2][1]-c[0][1] or c[2][0]-c[0][0] != c[2][2]-c[0][2]:
  print("No")
  sys.exit()
if c[0][1]-c[0][0] != c[1][1]-c[1][0] or c[2][1]-c[2][0] != c[1][1]-c[1][0]:
  print("No")
  sys.exit()
if c[0][2]-c[0][0] != c[1][2]-c[1][0] or c[2][2]-c[2][0] != c[1][2]-c[1][0]:
  print("No")
  sys.exit()
print("Yes")

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

template <typename T>
T gcd(T x, T y)
{
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

template <typename T>
T lcm(T x, T y)
{
    if (x == 0 || y == 0)
        return 0;
    return x / gcd(x, y) * y;
}

int main()
{
    int N;
    cin >> N;
    vector<unsigned long long> L(86);
    L[0] = 2;
    L[1] = 1;
    for (int i = 2; i < 87; i++)
    {
        L[i] = L[i - 1] + L[i - 2];
    }
    cout << L[N] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main() {
  long int A, B, N;
  double LOG;
  scanf("%ld", &N);

  LOG = log10(N);

  int sum = 0; 
  if (LOG == (int)LOG){
    sum = 10;
  }else{
    while (N != 0) { 
     sum += N % 10; 
      N = N/10; 
    } 
  }

  printf("%d\n", sum);
}


Measured memory_bytes: 512
#include <iostream> // cout, endl, cin
#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
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

int main(void) {
    int num;
    cin >> num;
    string str;
    cin >> str;

    // aba: (1+1)*(2+1)
    vector<int> map(26);
    for(int i = 0; i < num; i++) {
        map[str[i]-'a']++;
    }
    int64_t sum = 1;
    for(int i = 0; i < 26; i++) {
        sum = (sum * (map[i]+1))%DIVISOR;
    }
    // exclude empty string
    sum = (sum + DIVISOR - 1)%DIVISOR;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3760
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




















int main(){
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n + 1);
    REP(i, n){
        cin >> a[i + 1];
    }
    
    vector<vector<ll>> dp(k + 1, vector<ll>(n + 1, -INF));
    for(ll j = 0; j <= n; j++){
        dp[0][j] = 0;
    }
    for(ll i = 1; i <= k; i++){
        deque<ll> que = {0};
        ll l = 1, r = 1;
        for(ll j = 1; j <= n; j++){
            dp[i][j] = dp[i - 1][que.front()] + i * a[j];
            while (!que.empty() && dp[i - 1][que.back()] <= dp[i - 1][r]) que.pop_back();
            que.push_back(r++);
            if(j > m){
                if (que.front() == l++) que.pop_front();
            }
        }
    }
    
    cout << *max_element(dp[k].begin() + k, dp[k].end()) << endl;
}

Measured memory_bytes: 237824
#include <iostream>
#include <iostream>
#include <string.h>
#include <vector>
#include <queue>
#include <cstdio>
#include <math.h>
#include <map>
#include <algorithm>
#include <deque>
#include <stack>
#include<set>
//#include <bits/stdc++.h>
#define lson l,mid,rt<<1

#define rson mid+1,r,rt<<1|1

const int N=1e5+100;
using namespace std;

typedef long long ll;
const int inf=0x3f3f3f3f;

char s[3030],t[3030];

int dp[3030][3030];
int flag[3030][3030];
void plcs(int i,int j)
{
    if(i==0||j==0) return ;
    if(flag[i][j]==0){
        plcs(i-1,j-1);
        cout<<s[i-1];
    }
    else if(flag[i][j]==1) plcs(i-1,j);
    else plcs(i,j-1);
}
int main()
{
    scanf("%s%s",s,t);
    int l=strlen(s);
    int ll=strlen(t);
    for(int i=1;i<=l;i++){
        for(int j=1;j<=ll;j++){
            if(s[i-1]==t[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
                flag[i][j]=0;
            }
            else if(dp[i-1][j]>=dp[i][j-1]){
                dp[i][j]=dp[i-1][j],flag[i][j]=1;
            }
            else dp[i][j]=dp[i][j-1],flag[i][j]=-1;
        }
    }
    plcs(l,ll);
    return 0;
}


Measured memory_bytes: 72064
#include <bits/stdc++.h>
#define ll long long
#define vl vector<ll int>
#define vs vector<string>
#define v vector<int>
#define mi map<int,int>

//ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	string s;
	cin>>s;
	v A;
	int i,c=0;
	for(i=0;i<3;i++){
		if(s[i]=='R'){A.push_back(i);}
		else{continue;}		
		}
		int m=A.size(),s1=0;
		if(m==1){s1=1;}
		if(m==0){s1=0;}
		else{
			for(i=1;i<m;i++){
				if(A[i]-A[i-1]==1){
					c++;
					s1=c+1;
					}
					else{s1=1;}
				}
			}
			cout<<s1 <<"\n";
	}



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

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

	int flg = 0;
	rep(i,t.size() - 1){
		if(s.at(i) != t.at(i)){
			flg++;
			break;
		}
	}

	if(!flg)
		cout << "Yes" << endl;
	else
	{
		cout << "No" << endl;
	}
	
}

Measured memory_bytes: 3632
while True:
  a, b, c = input().split()
  a = int(a)
  c = int(c)
  if b == "+":
    print(a+c)
  elif b == "-":
    print(a-c)
  elif b == "/":
    print(int(a/c) )
  elif b == "*":
    print(a*c)
  else:
    break
  


Measured memory_bytes: 5596
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
	int a, b, c, i, n;
	scanf("%d %d %d", &a, &b, &c);
	n = 0;
	for (i = a; i <= b; ++i){
		if (c%i == 0) ++n;
	}
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 596
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int a, b; char op;
    while (cin >> a >> op >> b, op != '?') {
        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;
    }
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;
int main()
{
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for(int i=0; i<N-2; i++){
    if(S.at(i)=='A' && S.at(i+1)=='B' && S.at(i+2)=='C') ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    string S;
    cin >> S;
    if(S.size() == 2) {
        cout << S << endl;
    }
    else {
        cout << S[2] << S[1] << S[0] << endl;
    }
}

Measured memory_bytes: 256
main=do
  (a,b)<-splitAt 2<$>getLine
  let (x,y) = (read a,read b)
  putStr $ solve x y

solve x y
  | invalid x && invalid y = "NA"
  | invalid x = "YYMM"
  | invalid y = "MMYY"
  | otherwise = "AMBIGUOUS"

invalid x = x > 12 || x == 0

Measured memory_bytes: 508
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif




#define int long long
#define rng(i,l,r) for(size_t i=(l);i<(r);++i)
#define rep(i,n) rng(i,0,n)
#define gnr(i,l,r) for(size_t i=(r)-1;i>=(l);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()   //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend()//...,3,2,1

using namespace std;


//constant
const int MOD = 1e9+7;
const int INF = 1e18;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};
const double pi = acos(-1);


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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
//*max_element(ALL(vector))
//count(ALL(vector),num) -> n
//memset(obj,value,sizeof(obj));




void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,m; cin >> n >> m;
    cout << (((2*n+m)/4<n)?m/2:(2*n+m)/4) << endl;
    
    
}





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




Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	var a int
	fmt.Scan(&s)

	if s[0] == '1' {
		a++
	}
	if s[1] == '1' {
		a++
	}
	if s[2] == '1' {
		a++
	}
	fmt.Println(a)
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

#define all(v) 			((v).begin()), ((v).end())
#define sz(v) 			((int)((v).size()))
#define endl			"\n"
#define MOD             1000000007

typedef long long ll;

void File()
{
	//freopen("output.txt", "w", stdout);
	freopen("coffee.in", "r", stdin);
}
void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
}
const double pi = 2 * acos(0.0);
const int nn = 1e5 + 5;
const int oo = 0x3f3f3f3f;

int main()
{
	fast();
	int d;
	cin >> d;
	if (d == 25)
		cout << "Christmas\n";
	else if (d == 24)
		cout << "Christmas Eve\n";
	else if (d == 23)
		cout << "Christmas Eve Eve\n";
	else
		cout << "Christmas Eve Eve Eve\n";
#if _DEBUG
	system("pause");
#endif
	return 0;
}

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

int main() {
  ll n, m, k;
  cin >> n >> m >> k;

  vector<ll> a(n);
  vector<ll> b(m);

  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];

  vector<ll> sum_a(n + 1, 0);
  vector<ll> sum_b(m + 1, 0);

  ll a_max = n;
  ll b_max = m;
  for (int i = 1; i <= n; i++) sum_a[i] = sum_a[i - 1] + a[i - 1];
  for (int i = 1; i <= m; i++) sum_b[i] = sum_b[i - 1] + b[i - 1];

  for (int i = 1; i <= n; i++)
    if (sum_a[i] > k) a_max = i - 1;
  for (int i = 1; i <= m; i++)
    if (sum_b[i] > k) b_max = i - 1;

  if (sum_a[n] + sum_b[m] <= k) {
    cout << m + n << endl;
    return 0;
  }

  ll ans = 0;
  ll sb = 0;
  for (ll i = a_max; i >= 0; i--) {
    for (ll j = sb; j <= b_max; j++) {
      if (sum_a[i] + sum_b[j] > k) {
        sb = j;
        break;
      }
      ans = max(ans, i + j);
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 9544
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define PRINT(v) for (auto x : (V)) cout <<x <<" " <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int main() {
  int n,m; cin >>n >>m;
  vector<ll> x(m); rep(i, m) cin >>x[i];
  sort(all(x));
  if (n >= m){ cout <<0 <<endl; return 0; }

  vector<ll> y(m-1); rep(i, m-1) y[i] = x[i+1] - x[i];
  ll res = 0;
  rep(i, m-1) res += y[i];
  sort(all(y));
  rep(i, n-1) res -= y[m-2-i];
  cout <<res <<endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
#define mod 1000000007
#define int long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A) memset(A,0,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000000
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mpi map<pair<int,int> ,int>
#define mip map<int, pair<int,int> >
#define inf INT_MAX
#define inf1 LONGLONG_MAX
#define sz(v) v.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define deb(x) cout<<#x<<"is "<<x<<endl;
#define lower(s) transform(all(s),s.begin(),::tolower)
#define endl "\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, 
         tree_order_statistics_node_update> pbds;
   
/* brownsands :Arpit */			

void solve()
{    int k,n,mx=0,i;
   cin >> k >> n;int A[n+5];A[0]=0;
   for(i=1;i<=n;i++)
   {
      cin>>A[i];
      mx=max(mx,abs(A[i]-A[i-1]));

   }
   mx=max(mx,k-A[n]+A[1]);
   cout<<k-mx<<endl;
}
signed main()
{
   boost
        int test=0,t;
		//cin>>t;
		t=1;
		while(test++ <t){
            //cout<<"Case "<<test<<": ";
            solve();
            //cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
               }		
} 
               
			
 

				
		
		




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

int main() {
    int h, a;
    cin >> h >> a;
    for(int i; true; i++) {
        if(h <= a * i) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3528
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in) ;
	public static void main(String[]args) {
		Main m = new Main();
		m.run();
	}
	
	void run() {
		int c[] = new int[5];
		
		for(int i = 0 ; i < 6 ; i++) {
			c[sc.nextInt()]++;
		}
		
		boolean flag = false;
		for(int cc : c) {
			flag = flag || (cc == 3);
		}
		
		if(flag) {
			System.out.println("NO");
		}else {
			System.out.println("YES");
		}
		
	}
}

Measured memory_bytes: 23892
'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = arr[1];
  const length = a.length;
  let isDouble = true;

  if (a.length % 2 !== 0) {
    isDouble = false;
  }

  for (let i = 0; i < length / 2; i ++) {
    if (a[i] !== a[length / 2 + i]) {
      isDouble = false;
    }
  }
  
  console.log(isDouble ? 'Yes' : 'No');
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;
ll N, H, D;
ll dp[2005000];
ll imos[2000500];
ll inv[2000000];
ll FactorialInv[2000000];
ll Factorial[2000000];
ll FactorialSum[2000000];
ll beki(ll a, ll b){
    if(b == 0){
        return 1;
    }
    ll ans = beki(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}
void init_combination(){
    inv[1] = 1;
    FactorialInv[1] = 1;
    Factorial[1] = 1;
    Factorial[0] = 1;
    FactorialInv[0] = 1;
    inv[0] = 1;
    FactorialSum[1] = 1;
    for(int i = 2; i < 2000000; i++){
        inv[i] = beki(i, mod - 2);
        Factorial[i] = Factorial[i - 1] * i % mod;
        FactorialInv[i] = FactorialInv[i - 1] * inv[i] % mod;
        FactorialSum[i] = (FactorialSum[i-1] + Factorial[i]) % mod;
    }
}
ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    init_combination();
    cin >> N >> H >> D;
    for(int i = 1; i <= D; i++) dp[i] = Factorial[N];
    for(int before = 1; before <= H; before++) {
        imos[before] += imos[before-1];
        imos[before] %= mod;
        dp[before] += imos[before];
        dp[before] %= mod;
        imos[before+1] += dp[before] * FactorialSum[N-1];
        imos[before+D+1] -= dp[before] * FactorialSum[N-1];
        /*
        if(before + D >= H) {
            dp[H] += dp[before] * (N - 1);
            dp[H] %= mod;
        }
        */
        imos[before+1] += dp[before] * Factorial[N];
        imos[before+D+1] -= dp[before] * Factorial[N];
        /*
        if(before + D + 1 >= H) {
            dp[H] += dp[before] * Factorial[N];
            dp[H] %= mod;
        }
        */
        imos[before+1] = (imos[before+1]) % mod;
        imos[before+D+1] %= mod;
        imos[before+D+1] += mod;
        imos[before+D+1] %= mod;
        imos[before+D+2] %= mod;
        imos[before+D+2] += mod;
        imos[before+D+2] %= mod;
        //cerr << before << " " << imos[before] << " " << dp[before] << endl;
    }
    cout << dp[H] << endl;
    return 0;
}


Measured memory_bytes: 86272
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
int main() {
	std::cin.tie(0); std::cin.sync_with_stdio(false);
	long double a, b, x; std::cin >> a >> b >> x;
	if (x * 2 >= a * a * b) {
		long double space = a * a * b - x;
		auto height = space * 2 / (a * a);
		std::cout << std::setprecision(15) << std::fixed << std::atan(height / a) * 180 / std::acos(-1) << '\n';
	}
	else {
		long double height = x * 2 / (a * b);
		std::cout << std::setprecision(15) << std::fixed << std::atan(b / height) * 180 / std::acos(-1) << '\n';
	}
}

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


int main(){
    int vals[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int n;
    cin >> n;
    n--;
    cout << vals[n] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main () {

    int A;
    int B;
    int C;
    int D;

    std::cin >> A >> B >> C >> D;

    int areaA;
    int areaB;

    areaA = A * B;
    areaB = C * D;

    if (areaA > areaB) {
        std::cout << areaA << std::endl;
    } else if (areaA < areaB) {
        std::cout << areaB << std::endl;
    } else {
        std::cout << areaA << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x; cin>>x;
    if(x>=30)cout<<"Yes";
    else cout<<"No";
    return 0;
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int A, B;
  cin >> A >> B;
  int c_a = ceil(A / 0.08);
  int c_b = ceil(B / 0.10);
  int c = max(c_a, c_b);

  if (floor(c * 0.08) == A && floor(c * 0.10) == B) {
    cout << c << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
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); };
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_cnt(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 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 REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
int d[101010];
int rui[101010];

int main(){
    cin >> n;
    REP(i, n){
        cin >> d[i];
        rui[d[i]]++;
    }
    for(int i = 2;i < 101010;i++){
        rui[i] += rui[i - 1];
    }
    int ans = 0;
    for(int i = 1;i <= 101000;i++){
        int low = rui[i];
        int high = rui[101000] - rui[i];
        if(low == high)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        
        var a_group = a.GroupBy(e => e);
        var ab = a_group.Select(e => new { e.Key, Count = e.Count() }).Where(e => e.Count >= 2).OrderByDescending(e => e.Key).Take(2).ToArray();
        if (ab.Any())
        {
            if (ab[0].Count >= 4)
            {
                long max = ab[0].Key;
                Console.WriteLine(max * max);
                return;
            }
        }
        Console.WriteLine(ab.Count() >= 2 ? ab[0].Key * ab[1].Key : 0);

    }
}

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

const int mod = 1e9 + 7;

string s[1005];
int f[1005][1005];

int main() {
	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> s[i];
		s[i] = '$' + s[i];
	}
	f[0][1] = 1;
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= m; j++) {
		if (s[i][j] == '.') {
			f[i][j] = f[i - 1][j] + f[i][j - 1];
			f[i][j] %= mod;
		}
	}
	cout << f[n][m] << '\n';
}

Measured memory_bytes: 5248
#include <cstdio>
#include <algorithm>

int main()
{
  int n;
  scanf("%d", &n);
  int a[100];
  for (int i = 0; i < n; ++i)
  {
    scanf("%d", a + i);
  }
  std::sort(a, a + n);
  printf("%d\n", a[n - 1] - a[0]);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
ll MOD = 1000000007;
ll INF =1<<30;



int main(){
    string s;
    cin >>s;
    int n = s.size();
    bool ok = true;
    rep(i,n){
        if(s[i]!='9') ok = false;
    }
    if(ok) {
        cout << 9*n <<endl;
        return 0;
    }
    else {
        bool ok2 = true;
        rep(i,n-1){
            if(s[i+1]!='9') ok2 = false;
        }
        if(ok2){
            int c = s[0]-'0';
            cout << 9*(n-1)+c <<endl;
            return 0;
        }
        if(s[0]=='1'){
            cout << 9*(n-1) <<endl;
        }
        else {
            int c = s[0]-'0';
            cout << 9*(n-1)+c-1 <<endl;
        }
    }
}

Measured memory_bytes: 3576
#include <stdio.h>

int main(){
    int idx1, idx2;
    for(idx1 = 1; idx1 <= 9; ++idx1){
        for(idx2 = 1; idx2 <= 9; ++idx2){
            printf("%dx%d=%d\n", idx1, idx2, idx1*idx2);
        }
    }
    return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main()
{
	int n,y,i,j,k;
	scanf("%d%d",&n,&y);
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=n-i;j++)
		{
			k=n-i-j;
			if(i*1000+j*5000+k*10000==y)
			{
				printf("%d %d %d\n",k,j,i);
				return 0;
			}
		}
	}
	puts("-1 -1 -1");
	return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	x := nextInt()

	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}

	d := 0
	count := 1

	for i := 1; i < n+1; i++ {
		d = d + slice[i-1]
		// fmt.Println(d)
		if d <= x {
			count++
		}
	}

	fmt.Println(count)
}


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

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    string postal;
    cin >> postal;

    bool flag = true;

    for (int i = 0; i < a; i ++) {
        flag = flag && isdigit(postal[i]);
    }

    flag = flag && (postal[a] == '-');

    for (int i = a + 1; i < a + 1 + b; i ++) {
        flag = flag && isdigit(postal[i]);
    }

    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}



Measured memory_bytes: 256
import bisect
def main():

    N = int(input())
    A = list(map(int, input().split()))
    cntA = dict()
    for a in A:
        cntA[a] = cntA.get(a, 0) + 1

    cnt = dict()
    for a in cntA:
        cnt[cntA[a]] = cnt.get(cntA[a], 0) + 1

    sum1 = [0]
    for i in range(1, N+1):
        if i in cnt:
            sum1.append(sum1[-1]+ i * cnt[i])
        else:
            sum1.append(sum1[-1])

    sum2 = [0]
    for i in range(N, -1, -1):
        if i in cnt:
            sum2.append(sum2[-1]+cnt[i])
        else:
            sum2.append(sum2[-1])
    sum2 = sum2[::-1]

    vals = []
    for i in range(1, N+1):
        v = (sum1[i] + i * sum2[i+1]) // i
        vals.append(v)
    vals = vals[::-1]

    for i in range(1, N+1):
        j = bisect.bisect_left(vals, i)
        print(N-j)


if __name__ == '__main__':
    main()

Measured memory_bytes: 120356
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include<complex>

using namespace std;

typedef long long            ll;
typedef unsigned             ui;
typedef unsigned long long   ull;
typedef pair<int,int>        i_i;
typedef pair<ll,int>         ll_i;
typedef pair<ll,ll>          ll_ll;
typedef pair<double,int>     d_i;
typedef pair<double,double>  d_d;
typedef vector<int>          vi;
typedef vector<vector<int> > vii;

#ifdef DEBUG
#define dprintf      printf
#define dputs        puts
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dputs        (1)?0:puts
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__)
#define array(T,id,n) T id[(n)]; for(int i=0;i<(n);i++)cin>>id[i]
#define putv(n)     cout<<(n)<<endl

//#define int long long
#ifndef int
#define INF __INT32_MAX__
#else
#define INF __INT64_MAX__
#endif

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  int i;
  rep(i,3){
    in(string,s);
    cout<<s[i];
  }
  puts("");
  return 0;
}


Measured memory_bytes: 256
//============================================================================
// Author      : Kentaro Tanaka
//============================================================================

#include <iostream>
#include <cstdio>
#include <vector>
#include <array>
#include <chrono>

using namespace std;

int main() {
	int a,b,c;

	cin >> a >> b >> c;

	if( a <= c && c <= b ){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256