akhauriyash/Code-Regression huggingface dataset:
<?php
  $n = trim(fgets(STDIN));
  $a = explode(" ", trim(fgets(STDIN)));
  $color = [];
  for($i=0; $i<$n; $i++){
      if($a[$i] < 400) $color[1] = 1;
      else if($a[$i] < 800) $color[2] = 1;
      else if($a[$i] < 1200) $color[3] = 1;
      else if($a[$i] < 1600) $color[4] = 1;
      else if($a[$i] < 2000) $color[5] = 1;
      else if($a[$i] < 2400) $color[6] = 1;
      else if($a[$i] < 2800) $color[7] = 1;
      else if($a[$i] < 3200) $color[8] = 1;
      else $color[9]++;
  }
  for($i=1; $i<9; $i++){
      $min += $color[$i];
  }
  if($min == 0){
      $min = 1;
  }
  
  echo $min." ".array_sum($color);

Measured memory_bytes: 4728
import java.util.*;
 
public class Main {
 
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
 
        int min = 0;
        for(int i = 0;i < n;i++){
            if(s.charAt(i) == '.'){
                min++;
            }
        }
        int num = min;
        for(int i = 0;i < n;i++){
            if(s.charAt(i) == '#'){
                num++;
            } else {
                num--;
            }
            min = Math.min(num,min);
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 27404
#include<bits/stdc++.h>
using namespace std;
int n,ans;
string s;
int main()
{
	scanf("%d",&n);
	cin>>s;
	for(int i=0;i<n-2;++i)
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
			ans++;
	printf("%d",ans);
	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++)
using ll = long long;

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

  vector<ll> a(n), sasa(n-1);
  ll sum = 0;

  rep(i,n) {
    cin >> a.at(i);
    sum += a.at(i);
  }

  ll x=0;
  //ll sa = 10000000, sa_b=10000000;

  for(int i = 0; i < n - 1;i++){
    x += a.at(i);
    sum -= a.at(i);
    sasa.at(i) = abs(x - sum);
    //cout << sasa.at(i) << endl;
  }
  
  ll minsa=1000000000000;
  
  rep(i,n-1){
    if(sasa.at(i) < minsa) minsa = sasa.at(i);
  }

  cout << minsa << endl;
  
}




Measured memory_bytes: 3328
#include<stdio.h>
int main()
{
    int h,w;
    scanf("%d%d",&h,&w);
    int i,j;
    while(h!=0||w!=0)
    {
        for(i=0;i<h;i++)
        {
            for(j=0;j<w;j++) printf("#");
            printf("\n");
        }
        printf("\n");
        scanf("%d%d",&h,&w);
    }
    return 0;
}



Measured memory_bytes: 2580
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
	Scanner In = new Scanner(System.in);

	int n = In.nextInt();

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	     a[i] = In.nextInt();


	int count = 0;

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

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    }

	for(int i = 0; i < n - 1; i++)
	    System.out.print(a[i] + " ");

	System.out.println(a[n - 1]);
	System.out.println(count);
    

    }
}

Measured memory_bytes: 26280
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
using namespace std;

int64_t c[6];
int64_t N;
bool check(int64_t T){
    int64_t cnt=1;
    int64_t size=N;
    for(int i=0;i<5;++i){
        if(size>c[i]){
            size=c[i];
            cnt=N/c[i]+(N%c[i]?1:0);
        }
        if(T-i<cnt)return false;
    }
    return true;
}

int main() {
    cin>>N;
    for(int i=0;i<5;++i)cin>>c[i];
    int64_t lo=0,hi=3e15,mid;
    int64_t ans=0;
    while(lo<=hi){
        mid=(lo+hi)/2;
        if(check(mid))ans=mid,hi=mid-1;
        else lo=mid+1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N;
string S;
ll cnt_R, cnt_G, cnt_B;

int main()
{
    cin >> N;
    cin >> S;
    for (int i = 0; i < N; i++)
    {
        if (S[i] == 'R')
        {
            cnt_R++;
        }
        if (S[i] == 'G')
        {
            cnt_G++;
        }
        if (S[i] == 'B')
        {
            cnt_B++;
        }
    }
    ll num = cnt_R * cnt_G * cnt_B;

    ll rest = 0;
    for (int i = 1; i < 2000; i++)
    {
        for (int j = 0; j < N; j++)
        {
            int last = j + 2 * i;
            if (last >= N)
            {
                continue;
            }
            char a = S[j];
            char b = S[j + i];
            char c = S[j + 2 * i];
            if (a != b && b != c && c != a)
            {
                rest++;
            }
        }
    }

    cout << num - rest << endl;
}


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

int main() {
  long h,w,n;
  cin >> h >> w >> n;
  vector<long> a(n);
  vector<long> b(n);
  vector<long> ans(10);
  map<pair<long,long>,long> aaa;
  for(long i=0;i<n;i++) cin >> a[i] >> b[i];
  for(long i=0;i<n;i++) {
    for(long j=-2;j<=0;j++) {
      for(long k=-2;k<=0;k++) {
        aaa[{a[i]+j,b[i]+k}]++;
      }
    }
  }
  ans[0]=(h-2)*(w-2);
  for(auto itr=aaa.begin();itr!=aaa.end();itr++) {
    if(((*itr).first.first>=1&&(*itr).first.second>=1)&&((*itr).first.first<=h-2&&(*itr).first.second<=w-2)) ans[0]--,ans[(*itr).second]++;
  }
  
  for(long i=0;i<10;i++) cout << ans[i] << endl;
}

Measured memory_bytes: 61064
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 

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


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

int main() {

	int n; cin >> n;
	const int p = 26;
	vector<vector<int>> num(n, vector<int>(p, 0));
	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		for (int j = 0; j < s.size(); j++) {
			num[i][s[j] - 'a']++;
		}
	}

	string ans = "";
	for (int j = 0; j < p; j++) {
		int tmpMin = 2147483647;
		for (int i = 0; i < n; i++) {
			tmpMin = min(tmpMin, num[i][j]);
		}
				while (tmpMin--) {
			ans += (char)(j + 'a');
		}

	}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+9;
const double ep=1e-7;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const double pi=acos(-1);
#define debug1 puts("?");
#define debug(x) cout<<"##"<<(x)<<endl;
#define mk make_pair
#define PII pair<int,int>
#define PIII pair<int,PII >
#define PIII1 pair<PII,int>
#define PIL pair<int,ll>
#define PLL pair<ll,ll>
#define eb emplace_back
#define fi first
#define se second
#define rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define dep(i,a,b) for(register int i=(a);i>=(b);--i)
#define sd(x) scanf("%d",&(x))
#define slld(x) scanf("%lld",&(x))
#define sdd(x,y) scanf("%d%d",&(x),&(y))
#define sc(s) scanf("%s",(s))
#define pd(x) printf("%d\n",(x))
#define plld(x) printf("%lld\n",(x))
#define pdk(x) printf("%d ",(x))
#define plldk(x) printf("%lld ",(x))
#define pdd(x,y) printf("%d %d\n",(x),(y))
typedef long long ll;
ll s,res,dp[1009][2009];
void solve()
{
	slld(s);
	dp[0][0]=1;
	for(ll i=1;;i++)
	{
		if(s/i<3)break;
		for(ll j=i*3;j<=s;j++)
		{
			for(ll k=3;k<=j-(i-1)*3;k++)
			dp[i][j]=(dp[i][j]+dp[i-1][j-k])%mod;
		}
		res=(res+dp[i][s])%mod;
	//	cout<<"?"<<i<<' '<<res<<endl;
	}
	plld(res);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int T=1;
//	sd(T);
	while(T--)solve();
} 

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

#define K 1000
#define K2 K*2
#define K4 K*4

int cnt[K2][K2];
int sum[K4][K4];

int get( int x, int y, int k )
{
	return sum[x][y] + sum[x + k][y + k] - sum[x + k][y] - sum[x][y + k];
}

int main()
{
	int ans = 0;
	int n, k;
	int x, y;
	char c;

	cin >> n >> k;
	int k2 = k*2;
	for( int i = 0; i < n; i++ ) {
		cin >> x >> y >> c;
		if( c == 'W' ) {
			y += k;
		}
		x %= k2;
		y %= k2;
		cnt[x][y]++;
	}

	for(int i = 0; i < k2; i++ ) {
		for( int j = 0; j < k2; j++ ) {
			sum[i][j] = cnt[i][j];
			sum[i+k2][j] = cnt[i][j];
			sum[i][j+k2] = cnt[i][j];
			sum[i+k2][j+k2] = cnt[i][j];
		}
	}
	int k4 = k*4;
	for(int i = 0; i < k4; i++ ) {
		for( int j = 1; j < k4; j++ ) {
			sum[i][j] += sum[i][j - 1];
		}
	}
	for( int j = 0; j < k4; j++ ) {
		for( int i = 1; i < k4; i++ ) {
			sum[i][j] += sum[i - 1][j];
		}
	}

	for( int i = 0; i < k2; i++ ) {
		for( int j = 0; j < k2; j++ ) {
			int s = get( i, j, k ) + get( i + k, j + k, k );
			ans = max( ans, max( s, n - s ) );
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 78336
import java.util.*;

public class Main{
    public static void main(String... args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int l[] = new int[n*2];
        for(int i = 0; i < n*2; i++){
            l[i] = scan.nextInt();
        }
        Arrays.sort(l);
        int count = 0;
        for(int i = 0; i < l.length-1;i+=2){
            if(l[i] == l[i+1]){
                count+=l[i];
                continue;
            }else{
                count+=Math.min(l[i],l[i+1]);
            }
        }
        System.out.println(count);
    }
}

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

int main() {
	int N, x;
	vector<int> a;
	cin >> N >> x;

	for (int i = 0; i < N; i++) {
		int z; cin >> z; a.push_back(z);
	}

	long long counter = 0;
	for (int i = 1; i < N; i++) {
		int sum = a[i] + a[i - 1];
		if (sum > x) {
			if (x >= a[i - 1]) {
				a[i] = x - a[i - 1];
			}
			else {
				a[i] = 0;
				a[i - 1] = x;
			}
			counter += (sum - x);
		}
	}

	cout << counter << endl;
	return 0;
}

Measured memory_bytes: 892
#include <stdio.h>
#include<string.h>

int main()
{
int a[101][101];
int b[101];
int n,m;
scanf("%d %d",&n,&m);
for(int i=1;i<=n;i++){
	for(int j=1;j<=m;j++){
		scanf("%d",&a[i][j]);
	}
}
for(int i=1;i<=m;i++){
	scanf("%d",&b[i]);
}
for(int i=1;i<=n;i++){
	int ans=0;
	for(int j=1;j<=m;j++){
		ans+=a[i][j]*b[j];
	}
	printf("%d\n",ans);
}
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;
inline void add(int &a,int b){
	a+=b;
	if(a>=mod)a-=mod;
}

int uku[5555];

int N;
vint G[5555];

vint dfs(int v,int p){
	vint dp(2);
	dp[1]=1;
	for(auto u:G[v]){
		if(u==p)continue;
		vint dp2=dfs(u,v);

		vint dp3(dp.size()+dp2.size()-1);
		rep(i,dp.size()){
			rep(j,dp2.size()){
				add(dp3[i+j],dp[i]*dp2[j]%mod);
				if(j%2==0)add(dp3[i],mod-dp[i]*dp2[j]%mod*uku[j]%mod);
			}
		}
		dp=dp3;
	}
	return dp;
}

signed main(){
	uku[0]=1;
	for(int i=2;i<=5000;i+=2){
		uku[i]=uku[i-2]*(i-1)%mod;
	}
	cin>>N;
	rep(i,N-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].pb(b);G[b].pb(a);
	}

	vint vec=dfs(0,-1);
	int ans=0;
	for(int i=2;i<=N;i+=2){
		ans=(ans+vec[i]*uku[i])%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1408
S = input()
N = len(S)

if (S == S[::-1]) and (S[0:int((N-1)/2)]==S[int((N-1)/2-1)::-1]) and (S[int((N+3)/2-1):N]==S[:int((N+3)/2-2):-1]):
    print('Yes')
else:
    print('No')

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

int main()
{
	std::set<int> inputs;

	int A;
	std::cin >> A;
	inputs.emplace(A);
	
	int B;
	std::cin >> B;
	inputs.emplace(B);

	int C;
	std::cin >> C;
	inputs.emplace(C);

	std::cout << (inputs.size() == 2 ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
using System;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    for (int i = N; i < 1000; i++) {
      if ((i/100) == ((i%100)/10) && (i/100) == (i%10)) {
        Console.WriteLine(i);
        break;
      }
    }
  }
}

Measured memory_bytes: 11092
import math
N = int(input())
city = [[] for _ in range(N)]
for i in range(N):
    a,b = map(int,input().split())
    city[i] = [a,b]
rout = [[0]*N for _ in range(N)]
total = 0
for i in range(N):
    for j in range(N):
        if city[i][0] == city[j][0] and city[i][1]==city[j][1]:
            continue
        else :
            sq = math.pow(city[i][0]-city[j][0],2) + math.pow(city[i][1]-city[j][1],2)
            total  += math.sqrt(sq)
print(total/N)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 2147483647;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 2000005;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[SIZE], finv[SIZE], inv[SIZE];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;
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; }

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

double len(int a, int b, int c, int d) {
	return (double)sqrt((a - c) * (a - c) + (b - d) * (b - d));
}

ll a, b, leng, ans, mon;
string snuke;

ll f(ll n) {
	ll uku = 2, ushi = n - 2, tapu = n - 1;
	for (int i = 0; i < b - 1; ++i) {
		tapu += uku + ushi * 2;
		uku = (uku + ushi) * 2;
	}

	return 2 * uku + 3 * ushi + tapu;
}

int main() {
	cin >> a >> b >> snuke;

	for (int i = 0; i < a; ++i) {
		if (snuke[i] == 'x') {
			if (leng) { ans += f(leng); }
			leng = 0;
			++mon;
		}
		else { ++leng; }
	}

	if (leng) { ans += f(leng); }

	cout << ans + mon << endl;
}


Measured memory_bytes: 3204
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr ll INF = 1ll << 55;

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

// multi-dimensional vector (require c++14)
template <typename T, typename U>
static inline vector<U> make_nd_vector(T &&n, U &&val) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<U>(forward<T>(n), forward<U>(val));
}
template <typename T, typename... Args>
static inline decltype(auto) make_nd_vector(T &&n, Args &&... args) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<decltype(make_nd_vector(forward<Args>(args)...))>(
      forward<T>(n), make_nd_vector(forward<Args>(args)...));
}
//
// Print from Iterator
template <typename ite>
void print_ite(ite start, ite end, char sp = ' ', char en = '\n') {
  for (auto i = start; i != end; i++)
    cout << *i << sp;
  cout << en;
}
//
inline void Yes(bool condition) { cout << (condition ? "Yes\n" : "No\n"); }

using namespace std;
template <typename T> class SparseTable {
  vector<vector<T>> st;
  // st[i][j]:=j$B$+$i(B2^i$B8D$NHO0O$G$N(Bmax
  vector<int> log;

public:
  SparseTable(const vector<T> &vec) {
    int b = 1;
    while ((1 << b) <= vec.size()) {
      b++;
    }
    st.assign(b, vector<T>(1 << b));
    for (int i = 0; i < vec.size(); i++) {
      st[0][i] = vec[i];
    }
    for (int i = 1; i < b; i++) {
      for (int j = 0; j + (1 << i) <= (1 << b); j++) {
        st[i][j] = max(st[i - 1][j], st[i - 1][j + (1 << (i - 1))]);
      }
    }
    log.resize(vec.size() + 1);
    for (int i = 2; i < log.size(); i++) {
      log[i] = log[i >> 1] + 1;
    }
  }
  inline T query(int l, int r) {
    // [l,r)
    int b = log[r - l + 1];
    return max(st[b][l], st[b][r - (1 << b) + 1]);
  }
};
int main() {
  int n, t;
  cin >> n >> t;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  auto st = SparseTable<int>(a);
  vector<int> diff(n);
  for (int i = 0; i < n - 1; i++) {
    diff[i] = st.query(i + 1, n) - a[i];
  }
  diff[n - 1] = -1;
  int max_dif = 0;
  for (int i = 0; i < n; i++) {
    chmax(max_dif, diff[i]);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (max_dif == diff[i])
      ans++;
  }
  cout << ans << endl;
}


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

using namespace std;

long long n,op[120],tot;
deque <int> L;
int main()
{
	scanf("%lld",&n); n++; while(n>1)
	{
		op[++op[0]]=n&1; n>>=1;
	}tot=1;
//	for(int i=1;i<=op[0];i++) printf("%d ",op[i]); printf("\n");
	for(int i=op[0];i>=1;i--)
		if(op[i]) L.push_back(tot++),L.push_front(tot++);
		else L.push_back(tot++);
	printf("%lld\n",tot+tot-2);
	for(int i=1;i<tot;i++) printf("%lld ",L.front()),L.pop_front();
	for(int i=1;i<tot;i++) printf("%lld ",i);
	printf("\n");
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int long long
#define pb push_back
#define pi pair <int, int> 

int n, l[150], k;
int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int ans = 0;
	cin >> n >> k;
	for(int i = 0; i < n; ++i) {
		cin >> l[i];
	}
	sort(l, l+n, greater<int>());
	for(int i = 0; i < k; ++i) {
		ans += l[i];
	}
	cout << ans;
}

Measured memory_bytes: 3668
#include <iostream>

 

using namespace std;

 

int main()
{
   int i, h, m, s;     
   cin >> i;
   h = i / 3600;
   m = i / 60 - h * 60 ;
   s = i % 60;
   cout << h << ":" << m << ":" << s << endl;
   
   return 0;
}


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

#define rep(i, n)  for (int i = 0; i < (n) ; ++i)
#define mod 1000000007

using namespace std;
using ll=long long;

const int INF = 100000000;

int main() {
    ll A, B, N, x;
    ll res;
    cin >> A >> B >> N;
    if (N >= B) {
        x = B - 1;
    } else {
        x = N;
    }
    res = (A * x) / B - A * (x / B);

    cout << res;
    return 0;
}


Measured memory_bytes: 3624
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define re return
#define pb push_back
#define po pop_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define ss second.second
#define sf second.first
#define ff first.first
#define fs first.second
#define si size
#define sqrt(x) sqrt(abs(x))
#define mp make_pair
#define pi 3.14159265359
#define er erase
#define in insert
#define em empty
#define ft front
#define fo(i,n) for(i = 0; i < n; i++)
#define ro(i,n) for(i = n - 1; i >= 0; i--)
#define fr(i,j,n) for(i = j; i < n; i++)
#define rf(i,j,n) for(i=n-1;i>=j;i--)
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::pair<int,int> ii;
typedef std::vector<ii> vii;
typedef std::vector<std::string> vs;
typedef double dl;
typedef long double ld;
typedef long long ll;
typedef std::pair<ll, ll> pll;
typedef std::vector<ll> vll;
#define filename ""
using namespace std;
    pair<int,int> p[(int)101],pp[101];
    map<int,int> m;
int main()
{
    /*
	freopen(filename".in","r",stdin);
	freopen(filename".out","w",stdout);
	*/
	/*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    */
    /*
    ios::sync_with_stdio(0);
    */
    int n,i,x,y;
    cin>>n;
    fo(i,n)
    {
        scanf("%d%d",&p[i].fi,&p[i].se);
    }
    fo(i,n)
    {
        scanf("%d%d",&pp[i].fi,&pp[i].se);
    }
    sort(p,p+n);
    sort(pp,pp+n);
    int o=0;
    int j=n-1;
    map<int,int>::iterator q;
    ro(i,n)
    {
        while(j>-1&&pp[j].fi>p[i].fi)
        {
            m[pp[j].se]++;
            j--;
        }
        q=m.lower_bound(p[i].se+1);
        if (q!=m.end())
        {
            o++;
            m[q->fi]--;
            if (m[q->fi]==0)
            {
                m.er(q->fi);
            }
        }
    }
    cout<<o<<'\n';
    re 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int dp[3005][3005];

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

  int S = s.length(), T = t.length();

  rep(i, S) dp[i][0] = 0;
  rep(i, T) dp[0][i] = 0;

  rep(i, S) {
    rep(j, T) {
      if (s[i] == t[j])
        dp[i + 1][j + 1] = dp[i][j] + 1;
      else
        dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
    }
  }

  string ans = "";
  int i = S, j = T;
  while (i > 0 && j > 0) {
    if (dp[i][j] == dp[i - 1][j])
      --i;
    else if (dp[i][j] == dp[i][j - 1])
      --j;
    else {
      ans = s[i - 1] + ans;
      --i, --j;
    }
  }

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


Measured memory_bytes: 35456
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

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

int main() {

  int n;
  cin >> n;

  function<bool(int)> query = [&](int k) {
    cout << k << endl;
    string s;
    cin >> s;
    if (s == "Vacant")
      exit(0);
    return s == "Male";
  };
  int l = 0, r = n - 1;
  bool resl = query(l), resr = query(r);
  while (r - l > 2) {
    int mid = (l + r) >> 1;
    bool res = query(mid);
    if ((res ^ resl ^ mid ^ l) & 1) {
      r = mid;
      resr = res;
    } else {
      l = mid;
      resl = res;
    }
  }
  query((l + r) >> 1);

  return 0;
}


Measured memory_bytes: 852
#include<bits/stdc++.h>
using namespace std;
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
   	#endif
    int a,b;
    cin>>a>>b;
    cout<<((a&1 && b&1)?"Odd":"Even");
   	return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    string s;
    cin >> s;
    cout << ((s.find('a') != string::npos && s.find('b') != string::npos && s.find('c') != string::npos) ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    a = list(map(int, input().split()))

    S = [0] * N
    S[0] = a[0]
    for i in range(N - 1):
        S[i + 1] = S[i] + a[i + 1]

    ans = float("inf")
    for i in range(N - 1):
        x = S[i]
        y = S[-1] - x
        cost = abs(x - y)
        if cost < ans:
            ans = cost

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 23800
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;


int main(){
	fastio;

	int n;
	cin>>n;
	ll a[n], total=0;
	forn(i,n){
		cin>>a[i];
		total += a[i];
	}

	ll ok = 0;
	ll jk = 0;
	forn(i,n){
		jk = ok;
		ok += a[i];
		if(ok>=total/2) break;
	}
	cout<<min(total-2*jk,2*ok-total)<<ln;

	return 0;
}

Measured memory_bytes: 1792
s = list(input())
count = 0
flag = 1
if s[0] == "A":
    s[0] = s[0].lower()
else:
    flag = 0
for i in range(2, len(s)-1):
    if s[i] == "C":
        s[i] = s[i].lower()
        count += 1
ss = "".join(s)
if not(ss.islower()) or count != 1:
    flag = 0
if flag == 1: print("AC")
else: print("WA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int dp[3010][3010];

int main() {
	string s,t;
	cin>>s>>t;
	
	int ssize=s.size(), tsize=t.size();
	
	dp[0][0]=0;
	
	for(int i=0; i<ssize ; i++){
		for(int j=0;j<tsize;j++){
			if(s[i]==t[j]) {
				dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1);
			
			}
			dp[i+1][j]=max(dp[i+1][j] ,dp[i][j]);
			dp[i][j+1]=max(dp[i][j+1], dp[i][j]);
		}
	}
	
	int ans=0,x,y;
	
	for(int i=1; i<=ssize;i++) 
		if (dp[i][tsize]>ans) {
			ans=dp[i][tsize];
			x=i;	y=tsize;
		}
	
	for(int i=1; i<=tsize;i++) 
		if (dp[ssize][i]>ans) {
			ans=dp[ssize][i];
			y=i;	x=ssize;
		}

	string r="";
	
	while(ans){
		if(s[x-1]==t[y-1]){
			r+= s[x-1];		
			x--;y--;ans--;
		}
		else if (dp[x-1][y]>dp[x][y-1]){
			x--;
		}
		else y--;
		
	}
	reverse(r.begin(),r.end());
	cout<<r<<endl;
	return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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 ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll h, w;
  cin >> h >> w;
  vector <vector <ll>> v(h, vector <ll> (w, 0));
  rep(i, h) {
    rep(j, w) {
      char c;
      cin >> c;
      if (c == '#') v.at(i).at(j) = 1;
    }
  }
  rep(i, h) {
    rep(j, w) {
      if (v.at(i).at(j)) {
        cout << '#';
      } else {
        ll tmp = 0;
        for (ll a = -1; a <= 1; a++) {
          for (ll b = -1; b <= 1; b++) {
            if (0<=i+a && i+a<h && 0<=j+b && j+b<w) tmp += v.at(i+a).at(j+b);
          }
        }
        cout << tmp;
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define  ll long long
#define  il inline
#define INF 0x3f3f3f3f
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define drep(i,a,b) for(int i=(a);i>=(b);--i)
#define pb push_back
#define fi first
#define se second
 
const int mod = 1e9 + 7;
const int maxn = 2e5 + 10;
const int maxm = 3e5 + 10;
const double PI = acos(-1.0);
const int inf = 1e9;
const double eps = 1e-6;

int n;
ll k,a[maxn],b[maxn],c[maxn];

bool check (ll x) {
    ll sum = 0;
    rep(i,1,n) {
        if(x - c[i] <= 0) {
            sum += (c[i] - x + b[i]) / b[i];
        }
    }
    if(sum <= k) return true;
    else return false;
}
int main()
{
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin >> n >> k;
    rep(i,1,n) cin >> a[i];
    rep(i,1,n) cin >> b[i];
    sort(a + 1, a + 1 + n);
    sort(b + 1, b + 1 + n);
    reverse(b + 1, b + 1 + n);
    rep(i,1,n) c[i] = a[i] * b[i];
    ll l = 0, r = 1e12 + 1;
    //cout << l << " " << r << endl;
    while(r - l > 1) {
        ll mid = (l + r) / 2;
        if (check(mid))
        {
            r = mid;
        }
        else l = mid;
        //cout << l <<" " << r << endl;
    }
    cout << l << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define scn(var)         cin >> var;
#define pYes()           prt("Yes")
#define pNo()            prt("No")
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"
//----------------------------------------------------------------
ll gcd(ll a, ll b){ return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){ return a/gcd(a,b)*b;}

ll div2(ll x){
  ll num=0;
  while(x%2==0){
    x /= 2;
    num++;
  }
  return num;
}

int main(void) {
  ll n, m;
  cin >> n >> m;
  arrll(a,n);
  rep(i,n){
    a[i] /= 2;
  }

  ll k=div2(a[0]);
  rep(i,n){
    if(k!=div2(a[i])){
      prt(0); return 0;
    }
    a[i] >>= k;
  }
  m >>= k;

  ll l=1;
  rep(i,n){
    l = lcm(a[i], l);
    if(l > m){
      prt(0); return 0;
    }
  }
  prt(1+(m-l)/(2*l));
}


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

int main()
{
	int n;
	cin>>n;
	double p[n];
	for (int i = 0; i < n; ++i)
	{
		/* code */
		cin>>p[i];
	}
	double dp[n+1][n+1];
	memset(dp,0,sizeof dp);
	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i)
	{
		dp[i][0] = (1-p[i-1])*dp[i-1][0];
	}

	for (int i = 1; i <= n; ++i)
	{
		for(int j = 1; j<=i; j++)
		{
			dp[i][j] = dp[i-1][j-1]*p[i-1]+dp[i-1][j]*(1-p[i-1]);
		}
	}
	double ans = 0;
	for (int i = (n+1)/2; i <= n; ++i)
	{
		ans += dp[n][i];
	}
	cout<<fixed<<setprecision(10)<<ans<<endl;
}

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

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	int x,y;cin>>x>>y;
	string s;cin>>s;
	if(sz(s)!=x+y+1) {cout<<"No";return 0;}
	rep(i,x){
		if(s[i]<'0'||s[i]>'9') {
			cout<<"No";return 0;
		}
	}
	if(s[x]!='-'){
			cout<<"No";return 0;
	}
	repA(i,x+1,x+y){
		if(s[i]<'0'||s[i]>'9') {
			cout<<"No";return 0;
		}
	}
	cout<<"Yes";
	return 0;
}


Measured memory_bytes: 256
l=input()
mod=10**9+7

dp=[[0]*2 for i in range(len(l)+1)]
dp[0][0]=1

for i in range(len(l)):
  dp[i+1][1]+=(dp[i][1]*3)%mod

  if l[i]=='1':
    dp[i+1][0]+=(dp[i][0]*2)%mod
    dp[i+1][1]+=(dp[i][0])%mod
  
  else:
    dp[i+1][0]+=(dp[i][0])%mod


print((dp[-1][0]+dp[-1][1])%mod)

Measured memory_bytes: 85748
#include <cstdio>

int main()
{
    int a, b, c;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if (a < b && b < c){
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 1008
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  int n;
  cin>>n;
  cin>>s;
   int a=s.length();
  if(a<=n){
    cout<<s<<endl;
    return 0;
  }
  for(int i=0;i<n;i++){
    cout<<s[i];
  }
  if(a>n) cout<<"..."<<endl;
  return 0;
}


Measured memory_bytes: 3628
import fractions
A,B,K = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
a = make_divisors(fractions.gcd(A,B))

ans = a[-K]
print(ans)

Measured memory_bytes: 5176
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< i_i, int>
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign


signed main()
{
    int2(n, k);
    while (n) {
        
        vi data(k);
        rep(i, k) {
            cin >> data[i];
        }
        sort(all(data));
        //rep(i, data.size()) cout << data[i] << " ";
        //cout << endl;

        int f = 0, b = 0;
        bool fl = false;
        if (!data[0]) {
            fl = true;
            f = b = 1;
        }
        f++;
        bool usefl = fl;
        int ans = 1, cnt = 1;
        while (f < k) {
            if (data[f-1]+1 == data[f]) {
                cnt++;
            } else if (data[f-1]+2 == data[f] && usefl) {
                usefl = false;
                b = f;
                cnt += 2;
            } else {
                if (fl != usefl) {
                    f = b;
                }
                b = f;
                usefl = fl;
                ans = max(ans, cnt);
                cnt = 1;
            }
            /*
            cout << "(" << b << ", " << f << ")";
            cout << cnt << " ";
            */
            f++;
        }
        ans = max(ans, cnt);
        cout << ans << endl;
        cin >> n >> k;
    }

    return 0;
}

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

using namespace std;

typedef long long int ll;

#define FOR(i,l,r) for(i=l;i<r;i++)

#define REP(i,n) FOR(i,0,n)

#define ALL(x) x.begin(),x.end()

#define P pair<ll,ll>

#define F first

#define S second

signed main(){

  ll N,i,ans;cin>>N;

  cout<<N+N*N+N*N*N<<endl;

  return 0;

}

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

int main(){
	int n, x, i, j, k, s;
		
	while(1){
		cin >> n >> x;
		
		if(n == 0 && x == 0){
			break;
		}
		
		s =0;
		for(i = 1; i <= n - 2; i++){
			for(j = i + 1; j <= n - 1; j++){
				for(k = j + 1; k <= n; k++){
					if(i + j + k == x){
						s++;
					}
				}
			}
		}
		cout<<s<<endl;
	}

 	return 0;
}

Measured memory_bytes: 3092
#include <string>
#include <iostream>
#include <stdio.h>
#include <deque>

using namespace std;

int main() {
  ios::sync_with_stdio(false);

  int num_query;
  cin >> num_query;

  int command, dir, val;
  deque<int> q;
  for (int i = 0; i < num_query; i++) {
    cin >> command;

    switch (command) {
      case 0:
        // push
        cin >> dir;
        cin >> val;
        if (dir == 0) {
          q.push_front(val);
        } else {
          q.push_back(val);
        }
        break;

      // random access
      case 1:
        cin >> val;
        cout << q[val] << endl;
        break;

      // pop
      case 2:
        cin >> dir;
        if (dir == 0) {
          q.pop_front();
        } else {
          q.pop_back();
        }

        break;
    }
  }
}




Measured memory_bytes: 4572
import collections
N,M=map(int,input().split())    
H=list(map(int,input().split()))
ans=[1]*N
for _ in range(M):
    AB=list(map(int,input().split()))
    if H[AB[0]-1] < H[AB[1]-1]:
        ans[AB[0]-1]=0
    elif H[AB[0]-1] > H[AB[1]-1]:
        ans[AB[1]-1]=0
    else:
        ans[AB[0]-1]=0
        ans[AB[1]-1]=0
#c=collections.Counter(ans)
print(ans.count(1))

Measured memory_bytes: 20648
s = input()
t = input()

dp = [[0]*(len(t)+1) for _ in range(len(s)+1)]

for i in range(1,len(s)+1):
    for j in range(1, len(t)+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

# DPを逆に辿って復元する
ans = ""
i = len(s)
j = len(t)
while( i>0 and j>0):
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1

print(ans)

Measured memory_bytes: 112220
fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line);
    let mut tok = line.split_whitespace();
    let mut a: i64 = tok.next().unwrap().parse().unwrap();
    let mut b: i64 = tok.next().unwrap().parse().unwrap();
    let mut c: i64 = tok.next().unwrap().parse().unwrap();
    let mut d: i64 = tok.next().unwrap().parse().unwrap();
    loop {
        c -= b;
        if c <= 0 {
            println!("Yes");
            break;
        }

        a -= d;
        if a <= 0 {
            println!("No");
            break;
        }
    }
}


Measured memory_bytes: 2152
#include <stdio.h>
int main()
{
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d=a/b;
    r=a%b;
    f=(double)a/(double)b;
    printf("%d %d %lf\n",d,r,f);
    return 0;

}



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

using namespace std;

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;

  locale l = locale::classic();
  cout << toupper(s1[0],l);
  cout << toupper(s2[0],l);
  cout << toupper(s3[0],l);
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
l,r = map(int,input().split())

if r - l + 1> 2019:
    print(0)
    exit()
else:
    ans = float('inf')
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            mods = (i * j) % 2019
            ans = min(ans,mods)

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16000000")
using namespace std;

const int Maxn = 200005;

int n;
vector <int> neigh[Maxn];
vector <int> inds[2];
vector <int> vals[3];
int res[Maxn];

void Traverse(int v, int p, int lvl)
{
    vals[v % 3].push_back(v);
    inds[lvl % 2].push_back(v);
    for (int i = 0; i < neigh[v].size(); i++) {
        int u = neigh[v][i];
        if (u == p) continue;
        Traverse(u, v, lvl + 1);
    }
}

void Assign(vector <int> &inds, vector <int> &vals)
{
    while (!inds.empty() && !vals.empty()) {
        res[inds.back()] = vals.back();
        inds.pop_back();
        vals.pop_back();
    }
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++) {
        int a, b; scanf("%d %d", &a, &b);
        neigh[a].push_back(b);
        neigh[b].push_back(a);
    }
    Traverse(1, 0, 0);
    if (inds[0].size() > inds[1].size())
        swap(inds[0], inds[1]);
    if (vals[0].size() >= inds[0].size()) {
        Assign(inds[0], vals[0]);
        Assign(inds[1], vals[0]);
        Assign(inds[1], vals[1]);
        Assign(inds[1], vals[2]);
    } else {
        Assign(inds[0], vals[1]);
        Assign(inds[0], vals[0]);
        Assign(inds[1], vals[0]);
        Assign(inds[1], vals[2]);
    }
    for (int i = 1; i <= n; i++)
        printf("%d%c", res[i], i + 1 <= n? ' ': '\n');
    return 0;
}


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

int main()
{
  string A;
  cin >> A;
  for (int bit = 0; bit < (1 << 3); bit++)
  {
    bitset<3> s(bit);
    //cout << s << endl;
    float sum = A.at(0) - '0';
    rep(i, 3)
    {
      if (s.test(i))
      {
        sum += A.at(i + 1) - '0';
      }
      else
      {
        sum -= A.at(i + 1) - '0';
      }
    }
    if (sum == 7)
    {
      rep(i, 3)
      {
        cout << A.at(i);
        if (s.test(i))
        {
          cout << '+';
        }
        else
        {
          cout << '-';
        }
      }
      cout << A.at(3) << "=7" << endl;
      exit(0);
    }
  }
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef vector<ll> vct;
int n,cnt,sz=0;
ll a[100007],b[100007],x,pr[3000];
map<ll,int> USS;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		for(ll j=2;j*j*j<=x;j++) while(x%(j*j*j)==0) x/=j*j*j;
		USS[x]++;
		a[i]=x;
		ll y=1;
		for(ll j=2;j*j*j<=x;j++)
		{
			if(x%j==0)
			{
				y*=j;
				if(x%(j*j)!=0) y*=j;
				while(x%j==0) x/=j; 
			}
		}
		ll x1=sqrt(x);
		if(x1*x1==x) y*=x1;
		else y*=x*x;
		b[i]=y;
	}
	if(USS[1])
	{
		cnt++;
		USS[1]=0;
	}
	for(int i=0;i<n;i++)
	{
		cnt+=max(USS[a[i]],USS[b[i]]);
		USS[a[i]]=USS[b[i]]=0;
	}
	cout<<cnt;
}

Measured memory_bytes: 17536
package main

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

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - Write and Erase
	var N int
	fmt.Scanf("%d", &N)

	A := make(map[int]int, N)
	var temp int
	for i := 0; i < N; i++ {
		temp = nextInt()
		if A[temp] == 0 {
			A[temp]++
		} else {
			A[temp]--
		}
	}

	var count int
	for _, v := range A {
		if v != 0 {
			count++
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 6144
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		try{
			InputStreamReader isr =new InputStreamReader(System.in);
	   		BufferedReader br =new BufferedReader(isr);
	        String dateString = br.readLine();
	       	System.out.println(isHeisei(dateString) ? "Heisei" : "TBD");
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}

	private static boolean isHeisei(final String dateString) {
		StringTokenizer st = new StringTokenizer(dateString, "/");
		final int y = Integer.parseInt(st.nextToken());
	    final int m = Integer.parseInt(st.nextToken());
	    final int d = Integer.parseInt(st.nextToken());
	    if (m <= 4) {
	    	return true;
	    }
		return false;
	}
}


Measured memory_bytes: 20564