akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using Vertex = int;
using Flow   = long long;
using Cost   = long double;

const Flow FLOW_INF = LLONG_MAX;
const Cost COST_INF = LDBL_MAX;

struct Edge {
  Vertex from, to;
  Flow capacity;
  Cost cost;
  int rev;
  Edge(Vertex from, Vertex to, Flow capacity = 0, Cost cost = 0, int rev = -1) : from(from), to(to), capacity(capacity), cost(cost), rev(rev) {}
};

class FlowNetwork {
 public:
  FlowNetwork(int n);
  void insert(const Edge&);
  Flow maximum_flow(Vertex source, Vertex sink) const;
  Cost minimum_cost_flow(Vertex source, Vertex sink, Flow f) const;

 private:
  int size_;
  std::vector<std::vector<Edge>> edge_;
};

// コンストラクタ
FlowNetwork::FlowNetwork(int n) : size_(n), edge_(n) {}

// 辺を追加
//   このとき、容量0コスト-cの逆辺も追加する
void FlowNetwork::insert(const Edge& e) {
  edge_.at(e.from).emplace_back(e.from, e.to, e.capacity, e.cost, edge_.at(e.to).size());
  edge_.at(e.to).emplace_back(e.to, e.from, 0, -e.cost, edge_.at(e.from).size() - 1);
}

// 最大流
//   Dinic: O(|V|^2 * |E|)
Flow FlowNetwork::maximum_flow(Vertex source, Vertex sink) const {
  std::vector<int> level;   // 各頂点に対するsourceからの距離
  std::vector<int> itr;     // 各頂点に対して、itr[v]番目以前の辺は使っても無駄
  auto residue = edge_;     // 残余グラフ
  // sourceから各頂点までの距離を計算し、sinkまでの距離を返す
  auto bfs = [&]() {
    level.assign(size_, -1);
    level.at(source) = 0;
    std::queue<int> q;
    q.push(source);
    while(!q.empty()) {
      auto v = q.front();
      q.pop();
      for(const auto& e: residue.at(v)) if(!~level.at(e.to)) if(0 < e.capacity) {
        level.at(e.to) = level.at(e.from) + 1;
        q.push(e.to);
      }
    }
    return level.at(sink);
  };
  // バックトラックを利用してフローを流す
  std::function<Flow(Vertex, Flow)> dfs = [&](Vertex v, Flow cur) {
    if(v == sink) return cur;
    for(auto& i = itr.at(v); i < residue.at(v).size(); ++i) {
      auto& e = residue.at(v).at(i);
      if(level.at(e.from) < level.at(e.to)) if(0 < e.capacity) {
        auto f = dfs(e.to, std::min(cur, e.capacity));
        if(f == 0) continue;
        e.capacity -= f;
        residue.at(e.to).at(e.rev).capacity += f;
        return f;
      }
    }
    return Flow(0);
  };
  // Dinic
  Flow result = 0;
  while(~bfs()) {
    itr.assign(size_, 0);
    while(auto f = dfs(source, FLOW_INF)) result += f;
  }
  return result;
}

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(auto& i: A) cin >> i;

  auto SOURCE = 0;
  auto SINK = N+1;
  A.insert(begin(A), 0);
  FlowNetwork G(N+2);
  for(auto i=1; i<=N; ++i) {
    if(A[i]<0) G.insert(Edge(SOURCE, i, -A[i]));
    else       G.insert(Edge(i, SINK, A[i]));
    for(auto j=i; j<=N; j+=i) G.insert(Edge(i, j, FLOW_INF));
  }

  Flow ans = 0;
  for(auto i: A) ans += max(0, i);
  cout << ans - G.maximum_flow(SOURCE, SINK) << endl;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int M = int.Parse(str[1]);
		int[]A = new int[M+1];
		int[]C = new int[N+1];
		for(var i=0;i<M;i++){
			A[i] = int.Parse(Console.ReadLine());
			C[A[i]] = 1;
		}
		long[,]B = new long[N+1,2];
		long mod = 1000000007;
		B[0,0]=1;
		for(var i=1;i<=N;i++){
			if(C[i]==0){
				B[i,0] = (B[i-1,0]+B[i-1,1]) % mod;
				B[i,1] = B[i-1,0] % mod;
			} else {
				B[i,1] = B[i-1,0] % mod;
			}
		}
		Console.WriteLine(B[N,0]);
	}
}

Measured memory_bytes: 14816
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
// #define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  ll n; cin >> n;
  ll avg = 0;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a[i];
    avg += a[i];
  }
  avg = round((ld)avg / n);
  // debug(avg);
  
  ll ans = 0;
  rep(i, n) {
    ans += abs(avg - a[i]) * abs(avg - a[i]);
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 512
import Control.Applicative

import Control.Monad
    (replicateM)
    
import Data.List
    (intersperse)
    
type Shuffles = [Int]

type Problem = [(String, Shuffles)]

type Result = [String]

shuffle :: String -> Int -> String

shuffle text index
    = (drop index text) ++ (take index text)
    
solve :: Problem -> Result

solve problem
    = map (\(t, s) -> foldl shuffle t s) problem

output :: Result -> String

output result
    = concat $ intersperse "\n" result
    
input :: IO Problem

input
    = inputProblem []
        
inputProblem :: Problem -> IO Problem

inputProblem problem
    = do
        text <- getLine
        if text == "-"
            then return problem
            else do
                shuffles <- inputShuffles
                inputProblem $ problem ++ [(text, shuffles)]
        
inputShuffles :: IO Shuffles
    
inputShuffles
    = do
        n <- read <$> getLine
        replicateM n $ read <$> getLine

main :: IO ()

main
    = putStrLn.output =<< solve <$> input

Measured memory_bytes: 4096
while True:
    a,b = map(int,input().split())
    if a == 0 and b==0:
        break
    for i in range(a):
        if i == 0 or i == a-1:
            print("#"*b)
        else:
            for s in range(b):
                if s == 0:
                    print("#",end='')
                elif s == b-1:
                    print("#")
                else:
                    print(".",end='')
    print('')


Measured memory_bytes: 9052
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


signed main(void) 
{
    ll n;
    cin >>n;
    if (n == 1) printf("%.10lf", 1.0);
    if (n%2 == 0) printf("%.10lf", 0.5);
    if (n%2 == 1 && n != 1) printf("%.10lf", double(n/2+1)/n);
    
   
}


Measured memory_bytes: 3752
while n =gets.to_i do
    if n==0 then
        break
    end
    x=Array.new(10,0)
    for i in 1..n do
        a=gets.to_i
        x[a]=x[a]+1
    end

    for i in 0..9 do
        if x[i]==0
            print '-'
        else
            for j in 1..x[i] do
                print '*'
            end
        end
        print "\n"
    end
end

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

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define lli long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()

#define forn(i, n)  for(int i=0;i<n;++i)
#define rforn(i,start) for(int i = start; i >= 0;--i)
#define forsn(i,start,end) for(int i=start;i<end;++i)
#define rforsn(i,start,end) for(int i=start;i>=end;--i)
#define debug(x) cout<<#x<<" = "<<x<<"\n";
const int CONST = 1e9 + 7;


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
	//    freopen("input.txt", "r", stdin);
	//  freopen("output.txt","w",stdout);
	#endif

    int n, k;
    cin>>n>>k;
    int ht[n];
    forn(i, n){
        cin>>ht[i];
    }
    int dp[n];
    dp[n-1]=0;

    rforsn(i, n-2, 0){
        dp[i]=INT_MAX;
        for(int j=1; j<=k && (i+j)<n; ++j){
            dp[i] = min(dp[i+j]+ abs(ht[i+j]-ht[i]), dp[i]);
        }
    }
    cout<<dp[0];
	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cmath>
 
#define PI_ 60*M_PI/180
 
struct P{
  double x,y;
 
  P (double x = 0 ,double y = 0) : x(x), y(y) {}
 
  P operator + (P p){
    return P(x + p.x , y + p.y);
  }
 
  P operator - (P p){
    return P(x - p.x , y - p.y);
  }
 
  P operator * (double k){
    return P(x * k , y * k);
  }
 
  P operator / (double k){
    return P(x / k , y / k);
  }
};
 
void solve(P p1,P p2,int end){
  if(end == 0){
    printf("%.8f %.8f\n" ,fabs(p1.x) ,fabs(p1.y));
    return;
  }
 
  P c = (p2 - p1) / 3, d = c * 2;
  P s = p1 + c , t = p1 + d;
  P u;
 
  u.x = s.x + (t.x - s.x) * cos(PI_) - (t.y - s.y) * sin(PI_);
  u.y = s.y + (t.x - s.x) * sin(PI_) + (t.y - s.y) * cos(PI_);
 
  solve(p1,s,end-1);
  solve(s,u,end-1);
  solve(u,t,end-1);
  solve(t,p2,end-1);
 
}
 
int main(){
  int n;
  P p1(0,0), p2(100,0);
 
  scanf("%d" ,&n);
  solve(p1,p2,n);
  printf("%.8f %.8f\n" ,p2.x ,p2.y);
 
  return 0;
}

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  const int m=1000000;
  int cnt=0;
  while(a%2==0 && b%2==0 && c%2==0 && cnt<m){
    int x=b/2+c/2;
    int y=a/2+c/2;
    int z=b/2+a/2;
    a=x;b=y;c=z;
    cnt++;
    //printf("%d %d %d\n",a,b,c);
  }
  printf("%d\n",cnt<m?cnt:-1);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> P(N);
  rep(i, N) cin >> P[i];

  vector<int> Q(N);
  rep(i, N) Q[P[i] - 1] = i;

  int longest = 1;
  int current = 1;
  rep(i, N - 1) {
    if (Q[i] < Q[i + 1]) {
      ++current;
    } else {
      longest = max(longest, current);
      current = 1;
    }
  }
  longest = max(longest, current);
  int answer = N - longest;
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 4844
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

S = X()

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        print("Bad")
        sys.exit()

print("Good")


Measured memory_bytes: 10024
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		int W;
		int H;
		int x;
		int y;
		int r;
		Scanner scan=new Scanner(System.in);
		W=scan.nextInt();
		H=scan.nextInt();
		x=scan.nextInt();
		y=scan.nextInt();
		r=scan.nextInt();
		
		if(x+r>W || x-r<0 || y+r>H || y-r<0){
			System.out.println("No");
		
	    }else{
	    	System.out.println("Yes");
	    }
		
     }	
}



Measured memory_bytes: 26396
#include<bits/stdc++.h>
using namespace std;
int main(){
    double n,t,a;
    int i,j;
    cin >> n >> t >> a;
    vector<long> h(n);
    for(i=0;i<n;i++)cin >> h.at(i);
    int b=0;
    double sy=0;
    double sai=10000;
    for(i=0;i<n;i++){
        sy=t-(h.at(i))*0.006;
        sai=min(sai,abs(a-sy));
        //cout << i << "番目 "<< sy << " " << sai << endl;
        if(sai==abs(a-sy))
        b=i;
    }
    cout << b+1 << endl;
    return 0;
}

Measured memory_bytes: 256
H,W=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
lst=[]
for i in range(n):
    for j in range(l[i]):
        lst.append(i+1)
ans=[[None]*W for _ in range(H)]
nuri=[-1,0]
switch=0
for num in lst:
    if switch==0:
        if nuri[0]+1>H-1:
            nuri[1]+=1
            ans[nuri[0]][nuri[1]]=num
            switch=1
        else:
            nuri[0]+=1
            ans[nuri[0]][nuri[1]]=num
    else:
        if nuri[0]-1<0:
            nuri[1]+=1
            ans[nuri[0]][nuri[1]]=num
            switch=0
        else:
            nuri[0]-=1
            ans[nuri[0]][nuri[1]]=num
for i in ans:
    print(" ".join(map(str,i)))

Measured memory_bytes: 73328
import Control.Monad (when)


main :: IO ()
main = do
    cs <- fmap (zip [1..]) getLine :: IO [(Int, Char)]
    let as    = map fst . filter (\c -> snd c == '\\') $ cs
        bs    = map fst . filter (\c -> snd c == '/' ) $ cs
        areas = solve as bs []
    print $ sum areas
    putStr . show $ length areas
    when (areas /= []) $ putStr " "
    putStrLn $ unwords . map show . reverse $ areas


solve :: [Int] -> [Int] -> [(Int, Int)] -> [Int]
solve as []     areas = map snd areas
solve as (b:bs) areas =
    case getDown as b of
        Nothing ->
            solve as  bs areas
        Just a  ->
            solve as' bs (step areas')
          where
            as'    = [ x | x <- as, a /= x ]
            areas' = (a, b - a) : areas


getDown :: [Int] -> Int -> Maybe Int
getDown as b =
    case takeWhile (<b) as of
        [] ->
            Nothing
        cs ->
            Just (last cs)


step :: [(Int, Int)] -> [(Int, Int)]
step areas@((x, xa):(y, ya):rest)
    | y < x     = areas
    | otherwise = step $ (x, xa + ya) : rest
step areas = areas



Measured memory_bytes: 8052
c = []

for i in range(3):
    A = list(map(int, input().split()))
    c.append(A)
if c[0][0] + c[1][1]+ c[2][2] == c[1][0] + c[2][1] + c[0][2] == c[2][0] + c[0][1] + c[1][2]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int N=2e5+1000;
const LL P=1e9+7;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(int x){
    if(x>9) print(x/10);
    putchar(x%10+'0');
}
int n;
LL a[N],b[N];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%lld",&a[i]);
	b[n+1]=0;
	for(int i=n;i>=1;--i){
		b[i]=(b[i+1]+a[i])%P;
	}
	LL ans=0;
	for(int i=1;i<n;++i){
		ans=ans+a[i]*b[i+1]%P;
	}
	ans=ans%P;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6824
#include<stdio.h>
  
int main(){
    int i,j,y;
    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
            y = i * j;
            printf("%d",i);
            printf("x");
            printf("%d",j);
            printf("=");
            printf("%d\n",y);
 
        }
    }
    return 0;
}

Measured memory_bytes: 520
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {
            var S = cin.Read.ToCharArray().Distinct();

            char[] all = { 'a', 'b', 'c', 'd', 'e', 'f', 'g',
                           'h', 'i', 'j', 'k', 'l', 'm', 'n',
                           'o', 'p', 'q', 'r', 's', 't', 'u',
                           'v', 'w', 'x', 'y', 'z' };

            IEnumerable<char> diff = all.Except(S);

            if (!diff.Any())
            {
                WriteLine("None");
                return;
            }

            var sortedDiff = diff.OrderBy(c => c);
            WriteLine(sortedDiff.First());

        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 14432
/*
ベクトルと行列の積
2018/02/09
*/

#include<stdio.h>
int main(void){
  int a[100][100];
  int b[100];
  int c[100] = {0};/*∑[j=1:m]{aij x bj}*/
  int i,j,k;
  int n,m;/*nxm個の行列A*/

  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }

  for(i=0;i<m;i++){
    scanf("%d",&b[i]);
  }

  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      c[i] += a[i][j] * b[j];
    }
    printf("%d\n",c[i]);
  }     
  return 0;
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector <ll> H(N);
	ll ans = 0;
	cin >> H[0];
	ll prev = H[0];
	ll cnt = 0;
	for (int ii = 1; ii < N; ++ii){
		cin >> H[ii];

		if (prev >= H[ii]){
			cnt++;
		} else {
			ans = max(ans, cnt);
			cnt = 0;
		}
		prev = H[ii];
	}
	if (cnt > 0){
			ans = max(ans, cnt);		
	}


	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;

void dfs(string s, char mx, int n) {
    if ((int)s.length() == n) {
        cout << s << endl;
    } else {
        for (char c = 'a'; c <= mx; c++) {
            dfs(s + c,
                ((c == mx) ? (char)(mx + 1) : mx),
                n);
        }
    }
}

int main() {
    int n; cin >> n;
    dfs("", 'a', n);

}


Measured memory_bytes: 1536
#include <bits/stdc++.h> 
#define int long long
using namespace std; 
 
int knapSackRec(int W, int wt[], int val[], 
				int i, int** dp) 
{ 
	if (i < 0) 
		return 0; 
	if (dp[i][W] != -1) 
		return dp[i][W]; 
 
	if (wt[i] > W) { 
 
		// Store the value of function call 
		// stack in table before return 
		dp[i][W] = knapSackRec( 
W, wt, val, i - 1, dp); 
		return dp[i][W]; 
	} 
	else { 
 
		// Store value in a table before return 
		dp[i][W] = max( 
			val[i] + knapSackRec( 
						W - wt[i], wt, val, i - 1, dp), 
			knapSackRec(W, wt, val, i - 1, dp)); 
 
		// Return value of table after storing 
		return dp[i][W]; 
	} 
} 
 
int knapSack(int W, int wt[], int val[], int n) 
{ 
	// double pointer to declare the 
// table dynamically 
	int** dp; 
	dp = new int*[n]; 
 
	// loop to create the table dynamically 
	for (int i = 0; i < n; i++) 
		dp[i] = new int[W + 1]; 
 
	// loop to initially filled the 
// table with -1 
	for (int i = 0; i < n; i++) 
		for (int j = 0; j < W + 1; j++) 
			dp[i][j] = -1; 
	return knapSackRec(W, wt, val, n - 1, dp); 
} 
 
signed main() 
{ 
  int n, W;
  cin >> n >> W;
  int wt[n], val[n];
  for(int i = 0; i < n; i++)
  {
    cin >> wt[i] >> val[i]; 
  }
  cout << knapSack(W, wt, val, n); 
	return 0; 
} 

Measured memory_bytes: 78592
def lower_bound(a, target):
    ng = -1
    ok = len(a)
    while abs(ng-ok) > 1:
        mid = (ng+ok)//2
        if a[mid] >= target:
            ok = mid
        else:
            ng = mid
    return ok


def upper_bound(a, target):
    ng = -1
    ok = len(a)
    while abs(ng-ok) > 1:
        mid = (ng+ok)//2
        if a[mid] > target:
            ok = mid
        else:
            ng = mid
    return ok


def main():
    N = int(input())
    A = sorted(map(int, input().split()))
    B = sorted(map(int, input().split()))
    C = sorted(map(int, input().split()))

    ans = 0
    for i in range(N):
        b = B[i]
        ia = lower_bound(A, b)
        ic = upper_bound(C, b)

        ans += (N-ic)*ia
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 24052
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;


int main(){  
  int h,w,n;
  cin >> h >> w >> n;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  vector<vector<int>> data(h, vector<int>(w));
  int cnt=0;
  rep(i,h)rep(j,w){
      data[i][(i%2==0?j:w-1-j)] = cnt+1;
      a[cnt]--;
      if(a[cnt]==0){ cnt++; }
  }
  rep(i,h) {rep(j,w){
    cout << data[i][j] << " ";
  } cout << endl;
  }
  return 0;
}

Measured memory_bytes: 384
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

x,y,z = gi

x -= z
s = y+z
puts x/s


Measured memory_bytes: 2428
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> p(n);
  rep(i, n) {
    int x, l;
    cin >> x >> l;
    p[i].first = x - l;
    p[i].second = x + l;
  }

  sort(p.begin(), p.end());
  int ans = 1, res = 0;
  rep(i, n) {
    if (p[i].first < p[res].second) {
      if (p[i].second < p[res].second) res = i;
    }
    else {
      ans++;
      res = i;
    }
  }
  cout << ans << endl;
  


  







  
  return 0;
}


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

int main(){
  int n,m;
  vector<int> a(m);
  int count=0;
  
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>a[i];
    count+=a[i];
  }
  
  if(n-count>=0){
    cout<<n-count<<endl;
  }
  else{
     cout<<-1<<endl;
  }
}

    


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

using namespace std;

int main()
{
  int a[9];
  for(auto i=0;i<9;i++)
  {
    cin>>a[i];
  }
  int n;
  cin>>n;
  int temp;
  for(auto i=0;i<n;i++)
  {
    cin>>temp;
    for(auto i=0;i<9;i++)
    {
      if(a[i]==temp)
      {
        a[i]=0;
        break;
      }
    }
  }
  int flag=0;
  for(auto i=0;i<3;i++)
  {
    if(a[i]!=0)
    {
      flag=1;
      break;
    }
  }
  if(flag==0)
  {
    cout<<"Yes";
    return 0;
  }
  flag=0;
  for(auto i=3;i<6;i++)
  {
    if(a[i]!=0)
    {
      flag=1;
      break;
    }
  }
  if(flag==0)
  {
    cout<<"Yes";
    return 0;
  }

  flag=0;
  for(auto i=6;i<9;i++)
  {
    if(a[i]!=0)
    {
      flag=1;
      break;
    }
  }
  if(flag==0)
  {
    cout<<"Yes";
    return 0;
  }

  flag=0;
  for(auto i=0;i<9;i=i+3)
  {
    if(a[i]!=0)
    {
      flag=1;
      break;
    }
  }
  if(flag==0)
  {
    cout<<"Yes";
    return 0;
  }
  flag=0;
  for(auto i=1;i<9;i=i+3)
  {
    if(a[i]!=0)
    {
      flag=1;
      break;
    }
  }
  if(flag==0)
  {
    cout<<"Yes";
    return 0;
  }
  flag=0;
  for(auto i=2;i<9;i=i+3)
  {
    if(a[i]!=0)
    {
      flag=1;
      break;
    }
  }
  if(flag==0)
  {
    cout<<"Yes";
    return 0;
  }

  flag=0;
  for(auto i=0;i<9;i=i+4)
  {
    if(a[i]!=0)
    {
      flag=1;
      break;
    }
  }
  if(flag==0)
  {
    cout<<"Yes";
    return 0;
  }

  flag=0;
  for(auto i=2;i<8;i=i+2)
  {
    if(a[i]!=0)
    {
      flag=1;
      break;
    }
  }
  if(flag==0)
  {
    cout<<"Yes";
    return 0;
  }

  cout<<"No";

  return 0;
}


Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
inline ll bigmod(ll B,ll P){ll R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline ll ad(ll x,ll y){ll ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline ll sub(ll x,ll y){ll ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline ll gun(ll x,ll y){ll ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
const int N = 2e5 + 100;
namespace Combi {
    int fact[N], inv[N];

    int bm(int b, int p, int m) {
        if(p == 0) return 1%m;
        int t = bm(b,p/2,m);
        t = (1ll*t*t)%m;
        if(p&1) return 1ll*t*b%m;
        return t;
    }

    int C(int n, int r) {
        if(n < 0 or r < 0 or r > n) return 0;
        int ret = 1ll*fact[n]*inv[r]%mod;
        ret = 1ll*ret*inv[n-r]%mod;
        return ret;
    }
    // X1 + X2 + ... + Xvar = Sum
    int no_of_eqns(int sum, int var) {
        return C(sum+var-1,var-1); // Xi >= 0
        // return C(sum-1,var-1); // Xi > 0
    }
    void init() {
        fact[0] = 1;
        for(int i = 1; i < N; i++) {
            fact[i] = 1ll*fact[i-1]*i%mod;
        }
        inv[N-1] = bm(fact[N-1], mod-2, mod);
        for(int i = N-2; i >= 0; i--) {
            inv[i] = 1ll*inv[i+1]*(i+1)%mod;
        }
    }
}
int yo(int x,int y,int a,int b)
{
    int ret=1;
    int down=abs(a-x);
    int rgt=abs(b-y);
    int p=(down+rgt);
    ret=Combi::C(p,down);
    return ret;
}
 main()

{
    fast
    Combi::init();
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    int ses=0;
    for(int i=1;i<=h-a;i++)
    {
        int cost=yo(1,1,i,b);
        cost=gun(cost,yo(i,b+1,h,w));
        ses=ad(ses,cost);
    }
    cout<<ses<<endl;
    return 0;

}





































Measured memory_bytes: 6744
n = int(input())
A = list(map(int, input().split()))

from collections import Counter
from collections import deque

c = Counter(A)
d = deque(sorted(c.most_common()))
# print(d)

# print(d.popleft())

frg = True
for i in range(1, n+1):
    if d and frg:
        _q = d.popleft()
        frg = False
    elif not d and frg:
        _q = (-1, -1)

    if _q[0] == i:
        print(_q[1])
        frg = True

    else:
        print(0)


Measured memory_bytes: 120712
#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, len[15], p[15], nr, x;
bool aprins[15];
vector <int> v[14];
int verifica()
{
    for(int i=1;i<=m;i++)
    {
        int cate=0;
        for(int j=0;j<len[i];j++)
            if(aprins[v[i][j]])
                cate++;
        if(cate%2!=p[i])
            return 0;
    }
    return 1;
}
void backk(int k)
{
    if(k>n)
    {
        if(verifica())
            nr++;
    }
    else
    {
        aprins[k]=0;
        backk(k+1);
        aprins[k]=1;
        backk(k+1);
    }
}
int main()
{
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        cin>>len[i];
        for(j=0;j<len[i];j++)
        {
            cin>>x;
            v[i].push_back(x);
        }
    }
    for(i=1;i<=m;i++)
        cin>>p[i];
    backk(1);
    cout<<nr;
    return 0;
}


Measured memory_bytes: 256
n = int(input())


def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1


ans = []
for i in range(2, 55556):
    if len(ans) == n:
        print(*ans)
        exit()

    if is_prime(i) and i % 5 == 1:
        ans.append(i)


Measured memory_bytes: 39536
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
	      Scanner sc = new Scanner(System.in);
	      int n = sc.nextInt();
	      int[] moti = new int[n];
	      int dani = 0;
	      for(int i=0; i<n; i++) {
	  		moti[i] = sc.nextInt();
	  	}
	      Arrays.sort(moti);
	      for(int i=0; i<n; i++) {
	    	  if(i!=0 && moti[i] == moti[i-1]) {
	    		  continue;
	    	  }
	    	  else {
	    		  dani++;
	    	  }
	      }
	      System.out.println(dani);
	}
}

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


using namespace std;
using ll = long long;

int main() {
	int n;
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	if (n == 1) {
		cout << "Yes" << endl;
		return 0;
	}
	bool ans = true;
	int m = 0;
	for (int i = 0; i < n-1; i++) {
		if (h[i+1] < h[i]) {
			if (h[i + 1] != h[i] - 1||h[i]-1<m) {
				ans = false;
				break;
			}
		}
		m = max(m, h[i]-1);
	}
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i=(a); i<(b); i++)

int main() {
  int N,A;
  cin >> N >> A;
  N = N % 500;
  if (N <= A) cout << "Yes" << endl;
  else cout << "No" <<endl;
  return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
int p[3][110000];
int q[110000];
int r[110000];
vector<int>L;
vector<int>R;
int bit[110000];
int sum(int a,int b){
	if(a)return sum(0,b)-sum(0,a-1);
	int ret=0;
	for(;b>=0;b=(b&(b+1))-1)ret+=bit[b];
	return ret;
}
void add(int a,int b){
	for(;a<110000;a|=a+1)bit[a]+=b;
}
int ABS(int a){return max(a,-a);}
int t[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<3;i++){
		for(int j=0;j<a;j++){
			scanf("%d",&p[i][j]);
			p[i][j]--;
		}
	}
	bool dame=false;
	for(int i=0;i<a;i++){
		q[i]=p[0][i]/3;
		if(p[1][i]/3!=q[i]||p[2][i]/3!=q[i])dame=true;
		if(p[1][i]%3!=1)dame=true;
		r[i]=p[0][i]%3/2;
		t[q[i]]=r[i];
	}
	for(int i=0;i<a;i++)if(i%2!=q[i]%2)dame=true;
	if(dame){
		printf("No\n");return 0;
	}
 
	for(int i=0;i<a;i++){
		if(i%2==0)L.push_back(q[i]/2);
		else R.push_back(q[i]/2);
	}
	/*for(int i=0;i<L.size();i++){
		add(L[i],1);
		int tmp=i+1-sum(0,i);
		if(tmp)t[R[i]*2+1]^=tmp%2;
	}
	for(int i=0;i<L.size();i++){
		t[L[i]*2]^=(L[i]-i+1000000)%2;
	}
	std::sort(L.begin(),L.end());
	for(int i=0;i<110000;i++)bit[i]=0;
	for(int i=0;i<R.size();i++){
		add(R[i],1);
		int tmp=i+1-sum(0,i);
		if(tmp)t[L[i+1]*2]^=tmp%2;
	}
	for(int i=0;i<R.size();i++){
		t[R[i]*2+1]^=(R[i]-i+1000000)%2;
	}
	long long cl=0;
	long long cr=0;
	for(int i=0;i<a;i++){
		if(i%2==0)cl+=t[i];
		else cr+=t[i];
	}*/
	long long cl=0;
	long long cr=0;
	for(int i=0;i<L.size();i++){
		cl+=sum(L[i],109999);
		add(L[i],1);
cr+=r[i*2];
	}
	for(int i=0;i<110000;i++)bit[i]=0;
	for(int i=0;i<R.size();i++){
		cr+=sum(R[i],109999);
		add(R[i],1);
cl+=r[i*2+1];
	}
//	printf("%d %d\n",cl,cr);
	if(cl%2||cr%2)dame=true;
//	if(cl&&L.size()==2)dame=true;
//	if(cr&&R.size()==2)dame=true;
	if(dame)printf("No\n");
	else printf("Yes\n");
}

Measured memory_bytes: 3580
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k) {
    while (u != NIL && k != u->key ) {
        if (k < u-> key ) u = u->left;
        else u = u->right;
    }
    return u;
}

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z -> key = k;
    z -> left = NIL;
    z -> right = NIL;
    
    while( x != NIL ) {
        y = x;
        if ( z->key < x->key ) {
            x = x -> left;
        }
        else {
            x = x -> right;
        } 
    }
    z -> parent = y;
    if( y == NIL ) {
        root = z;
    }
    else {
        if ( z->key < y->key ) {
            y -> left = z;
        }
        else {
            y -> right = z;
        }
    }
}

void inorder(Node *u) {
    if ( u == NIL )  return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if ( u == NIL ) return;
    printf(" %d", u -> key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n, i, x;
    string com;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        cin >> com;
        if ( com[0] == 'f' ) {
            scanf("%d", &x);
            Node *t = find(root, x);
            if ( t != NIL) printf("yes\n");
            else printf("no\n");
        }
        else if ( com == "insert") {
            scanf("%d", &x);
            insert(x);
        }
        else if ( com == "print" ) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    
    return 0;
}


Measured memory_bytes: 21968
#include <stdio.h>
int main(void){
    int H,W,i,k;
    
    while(1){
        scanf("%d%d",&H,&W);
        if(H == 0 || W == 0){
            return 0;
        }
        for(i = 2;i <= H+1;i++){
            for(k = 2;k <= W+1;k++){
                if(i%2 == 0){
                    if(k%2 == 0){
                        printf("#");
                    }
                    else{
                        printf(".");
                    }
                }
                else{
                    if(k%2 == 0){
                        printf(".");
                    }
                    else{
                        printf("#");
                    }
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int n;
int cnt[3];

int main()
{
	read(n);
	for(;n--;){
		int x; read(x);
		int c;
		for(c=0; c<2; ++c){
			if(x%2) break;
			x/=2;
		}
		++cnt[c];
	}
	if(cnt[2] >= cnt[0] || (cnt[0] == cnt[2]+1 && cnt[1]==0)) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val s = readLine()!!
    if (s[2] == s[3] && s[4] == s[5]) {
        println("Yes")
    } else {
        println("No")
    }
}


fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 33660
program answer
  implicit none
  integer(8) :: i, N, count
  integer(8), allocatable :: D(:,:)
  read(*,*) N
  allocate(D(N,2))
  do i = 1, n
     read(*,*) D(i,:)
  end do

  do i = 1, N-2
     if(D(i,1)==D(i,2).and.D(i+1,1)==D(i+1,2).and.D(i+2,1)==D(i+2,2)) then
        write(*,*) 'Yes'
        stop
     end if
  end do
  
  write(*,*) 'No'
  stop
 end program answer

Measured memory_bytes: 2796
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args){
		int[] abo = {0,0,0,0};
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String tmp = null;
		int cup = 0;
		int mun = 0;
		int ter = 0;
		String[] rrr;
		int st = 0,sr = 0;
		double mon = 0;
		int syo=0,hisi=0;
		
		
		
		while(true){
			
			try {
				tmp = br.readLine();
			} catch (IOException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			
			if(tmp == null){
				break;
			}
			
			if(tmp.equals("")){
				break;
			}
			
			mon = Double.parseDouble(tmp);
			//System.out.println(mon);
			
			if(mon <= 48.0){
				System.out.println("light fly");
			}else if(mon > 48.0 && mon <= 51.0){
				System.out.println("fly");
			}else if(mon > 51.0 && mon <= 54.0){
				System.out.println("bantam");
			}
			else if(mon > 54.0 && mon <= 57.0){
				System.out.println("feather");
			}else if(mon > 57.0 && mon <= 60.0){
				System.out.println("light");
			}else if(mon > 60.0 && mon <= 64.0){
				System.out.println("light welter");
			}else if(mon > 64.0 && mon <= 69.0){
				System.out.println("welter");
			}else if(mon > 69.0 && mon <= 75.0){
				System.out.println("light middle");
			}else if(mon > 75.0 && mon <= 81.0){
				System.out.println("middle");
			}else if(mon > 81.0 && mon <= 91.0){
				System.out.println("light heavy");
			}else if(mon > 91.0){
				System.out.println("heavy");
			}
		}
	}

}

Measured memory_bytes: 15068
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcd(long long a,long long b){return a*b / gcd(a,b) / gcd(a,b);}
int main()
{
	int L,R,d;
	cin>>L>>R>>d;
	int cnt = 0;
	for(int i=L; i<=R; i++)
	{
		if(i%d==0)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{
	int a,b,c;
	cin >> a >> c >> b;
	if((a <= b && b <= c) || (b <= a && c <= b)) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int i,n;
    char s[10001];
    scanf("%d",&n);
    scanf("%s",s);
    for(i=0;s[i];i++){
        s[i]=s[i]+n;
        if(s[i]>90){
            s[i]=s[i]-26;
        }
    }
    printf("%s",s);
    return 0;    
}

Measured memory_bytes: 128
#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--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#define MAX 1000000

ll fact[MAX+10],fact_inv[MAX+10];

ll power(ll a,ll b){
  ll res=1;
  while(b>0){
    if(b&1) res = res*a % MOD;
    a = a*a % MOD;
    b = b >> 1;
  }
  return res;
}

void set_fact(){
  fact[0] = 1;
  FOR(i,0,MAX) fact[i+1] = (i+1)*fact[i] % MOD;
  fact_inv[MAX] = power(fact[MAX],MOD-2);
  FORR(i, MAX, 2) fact_inv[i-1] = i*fact_inv[i] % MOD;
  fact_inv[0] = 1;
}

int main()
{
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    ll X,Y;
    cin >> X >> Y;
    if((X+Y)%3!=0){cout << 0 << endl; return 0;}
    ll s,t;
    s = -X+2*Y;
    t = 2*X-Y;
    if(s%3!=0|t%3!=0) {cout << 0 << endl; return 0;}
    if(s<0|t<0) {cout << 0 << endl; return 0;}
    s /= 3;
    t /= 3;

    set_fact();
    ll ans;
    ans = (fact[s+t]*fact_inv[t]%MOD)*fact_inv[s]%MOD;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 15872
N,M = [int(it) for it in input().split()]
li=[int(it)%M for it in input().split()]
lis=[0]*(N+1)
sm = 0
for i in range(N):
  sm = (sm+li[i])%M
  lis[i+1]=sm
import collections
ccc = collections.Counter(lis)
s = 0
for k,c in ccc.items():
  if (c<2):
    continue
  if (c%2==0):
    s+=(c//2)*(c-1)
  else:
    s+=((c-1)//2)*c
print (s)
  

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

int main(){
    int n ;
    cin >> n ;
    vector<int> p(n) ;
    for (int i = 0; i < n; i++)
    {
        cin >> p.at(i) ;
    }
    int count = 0 ;
    for (int i = 1; i < n-1; i++)
    {
        if ( p.at(i-1) < p.at(i) )
        {
            if ( p.at(i) < p.at(i+1) )
            {
                count += 1 ;
            }
            
        }
        if ( p.at(i-1) > p.at(i) )
        {
            if ( p.at(i) > p.at(i+1) )
            {
                count += 1 ;
            }
            
        }
        
    }
    
    cout << count << endl ;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import heapq

# input
N, M = map(int, input().split())
A = list(map(int, input().split()))

# solve
ans = [-a for a in A]
heapq.heapify(ans)
for i in range(M):
    tmp = heapq.heappop(ans) * (-1) // 2
    heapq.heappush(ans, tmp * (-1))
ans = [-a for a in ans]

# output
print(sum(ans))


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

void BS(char a[]){
int i, len;
len = strlen(a);

for(i = 0; i < len; i++){
	if('A' <= a[i] && a[i] <= 'Z')
		a[i] += 32;
}
}


	



int main(void)
{
	char x[10] ,y[100];
	int i = 0;

	scanf("%s",&x);

	while(1){
	if(scanf("%s",&y) == EOF)
		break;
BS(y);
if(strcmp(x,y) == 0){
		i++;
}
}



printf("%d\n",i);

return 0;

}

Measured memory_bytes: 560