akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
class Main {
    static Scanner sc = new Scanner();
 
    public static void main(final String[] args) throws IOException {
        int n = sc.nextInt();
        String s = sc.next();
        char[] c = s.toCharArray();
        char temp = c[0];
        int ans = 1;
        for (int i = 1; i < n; i++) {
            if (c[i] != temp) {
                temp = c[i];
                ans++;
            }
        }
        System.out.println(ans);
    }
 
    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
 
        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }
 
        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
 
        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 23252
//
// Created by yuu on 2019-06-19.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>

using namespace std;

int amida[1010][110];

int main(void){
    while(true){
        int n,m,a;

        cin>>n>>m>>a;

        if(n==0 && m==0 && a==0){
            break;
        }
        // takasa yoko
        vector<int>Graph[1010];

        for (int i = 0; i < 1010; ++i) {
            for (int j = 0; j < 110; ++j) {
                amida[i][j] = 0;
            }
        }

        for (int i = 0; i < m; ++i) {
            int h, p, q;
            cin>>h>>p>>q;
            amida[h][p] = q;
            amida[h][q] = p;

        }

        int tugi = a;
        for (int i = 1009; i >= 0; --i) {
            int temp;
            temp = amida[i][tugi];

            if(temp == 0){
                continue;
            }
            tugi = amida[i][tugi];

        }

        cout<<tugi<<endl;

    }




    return 0;
}


Measured memory_bytes: 3460
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<numeric>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	int N;
	scanf("%d", &N);

	// 現在の場所
	int now_t = 0, now_x = 0, now_y = 0;
	// 次に行く場所
	int t, x, y;

	REP(i, N) {
		scanf("%d %d %d", &t, &x, &y);

		// まず最低限必要な時間
		int rest_t = t - now_t - (abs(x - now_x) + abs(y - now_y));
		if (rest_t < 0 || rest_t % 2 == 1) {
			printf("No\n");
			return 0;
		}

		// 更新
		now_t = t;
		now_x = x;
		now_y = y;
	}

	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int[][] a = new int[n][26];
        int[] min = new int[26];
        Arrays.fill(min, 100);

        for (int i = 0; i < n; i++) {
            for (char c : scanner.next().toCharArray())
                a[i][c - 'a']++;
            for (int j = 0; j < 26; j++)
                min[j] = Math.min(min[j], a[i][j]);
        }

        int length = 0;
        for (int i : min)
            length += i;

        char[] ans = new char[length];
        for (int i = 0, r = 0; i < 26; i++)
            Arrays.fill(ans, r, r += min[i], (char)(i + 'a'));
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int main() {
  string x;
  cin>>x;
  int scount=0;
  int tcount=0;
  int ans=0;
  for(int i=0;i<x.size();i++){
    if(x.at(i)=='S'){
      scount++;
    }
    else{
      tcount++;
    }
    if(tcount>scount){
      ans+=2;
      tcount--;
    }
  }
  cout<<ans;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-

# main
n = int(input())
array_p = [int(i) for i in input().split(' ')]

def is_second(input_list):
    sort = sorted(input_list)
    if input_list[1] == sort[1]:
        return True
    else:
        return False

count = 0
for i in range(1, n - 1):
    if is_second(array_p[i - 1 : i + 2]):
        count += 1

print(count)

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

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

  for (int i = 0; i < N.size(); i++) {
    if (N.at(i) == 'P')
      cout << 'P';
    else if (N.at(i) == 'D')
      cout << 'D';
    else if (N.at(i) == '?')
      cout << 'D';
  }
  cout << endl;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main (string[] args)
        {
            var N = Int32.Parse(Console.ReadLine());
            var lines = new List<string>();

            var result = new Dictionary<string, int> ();
            long total = 0;

            for(var i = 0;N > i;i++)
            {
                var line = new string(Console.ReadLine().OrderBy(v => v).ToArray());

                if (result.ContainsKey (line))
                {
                    result[line]++;
                    total += result[line];
                }
                else
                {
                    result[line] = 0;
                }
            }

            Console.WriteLine (total);
        }
    }
}

Measured memory_bytes: 29076
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/));
});
function main(input){
  input = input + ""
  input = input.match(/2/g)
  if(input === null) input = []
  console.log(input.length)
}

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

int main()
{
  int n;
  cin >> n;
  
  vector<bool>dp(n+1, false);
  dp[0] = true;
  
  for(int i = 100; i <= 105; i++)
  {
    for(int j = 0; j + i <= n; j++)
    {
      if(dp[j]) dp[j+i] = true;
    }
  }
  if(dp[n]) cout << 1 << endl;
  else cout << 0 << endl;
  
  return 0;
}

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

int main()
{
	int a,b;
	cin>>a>>b;
	if(a<=5)
	    cout<<0<<endl;
	else if(a>=6 && a<=12)
	    cout<<b/2<<endl;
	else
	    cout<<b<<endl;
	    
    return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
ll my_gcd(ll a, ll b) { return b ? my_gcd(b, a%b) : a; };
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout << dest << (sizeof...(Args) ? " " : ""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define unique_v(v) v.erase(std::unique(v.begin(), v.end()), v.end()) //必ずソート後に実行
#define out(...) (_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))

// ^^^ Template ^^^ //


int main() {
	in(ll, N);
	in_v(ll, a1, N);
	in_v(ll, a2, N);
	loop(i, N-1)
		a1[i + 1] += a1[i];
	a2[0] += a1[0];
	loop(i, N - 1)
		a2[i + 1] += max(a2[i], a1[i + 1]);
	out(a2[N - 1]);
	return 0;
}


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

int main()
{
	char in[1000];
	while (~scanf("%s",in))
	{
		int m ,len = strlen(in), flag = 0;
		if (strstr(in, "KIH") == NULL)
			flag = 1;
		for (int i = 0; i < len; i++)
		{
			if (!flag&&in[i] == 'A'&&in[i + 1] == 'A')
			{	
				flag = 1; 
				break;
			}
			if (in[i] == 'A')
			{
				for (int j = i; j <= len - 1; j++)
					in[j] = in[j + 1];
				len--;
				i--;
			}
		}
		in[len] = '\0';
		if (strcmp(in , "KIHBR")==0&&!flag)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 256
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0] * n

for i in range(n - 1):
  for j in range(i + 1, n):
    ans[min(j - i, abs(x - i) + 1 + abs(j - y))] += 1

for i in range(1, n):
  print(ans[i])

Measured memory_bytes: 9244
#include <map>
#include <set>
#include <list>
#include <cstdio>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define fr first
#define sc second
#define mp make_pair

typedef long long int64;
typedef pair< int, int > iP;
typedef pair< iP, int > iiP;

const int INF = 2 << 28;
const double EPS = 1e-10;

int H, mas[20][6];
int ans;


bool canDelete() {
    bool ret = false;
    for(int i = 0; i < H; i++) {
        int prev = -1, cnt = 0;
        for(int j = 0; j < 6; j++) {
            if(!(~prev)|| mas[i][j] == prev) cnt++, prev = mas[i][j];
            else {
                if(cnt >= 3) {
                    if(prev) ret = true;
                    ans += prev * cnt;
                    for(int k = j - 1; k >= j - cnt; k--)
                        mas[i][k] = 0;
                }
                cnt = 1;
                prev = mas[i][j];
            }
        }
    }
    return ret;
}

void drop() {
    for(int i = H - 1; i > 0; i--) {
        for(int j = 0; j < 5; j++) {
            if(mas[i][j] == 0) {
                for(int k = i - 1; k >= 0; k--) {
                    if(mas[k][j] != 0) {
                        mas[i][j] = mas[k][j];
                        mas[k][j] = 0;
                        break;
                    }
                }
            }
        }
    }
}

int main() {

    while(cin >> H, H) {
        ans = 0;
        memset(mas, 0, sizeof(mas));
        for(int i = 0; i < H; i++) {
            for(int j = 0; j < 5; j++) {
                cin >> mas[i][j];
            }
        }

        while(canDelete()) {
            drop();
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define int long long
#define mod 1000000007
#define INFi 2147483647
#define INFl 9223372036854775807LL
#define fi first
#define se second
#define be begin()
#define en end()
#define re reverse
#define Set setprecision 
int abs(int a,int b){
    return max(a,b)-min(a,b);
}
int gcd(int a,int b){//最大公約数
  int c=a%b;
  while(true){
    if(c==0) break;
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}
int lcm(int a,int b){//最小公倍数
  return (a*b)/gcd(a,b);
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);    
    int a[1000000];
    int b,c,d=0,e=0,j=0,q,x,y;
    b=1,c=1;
    for(int i=0;i<b;i++){
      cin>>e;
      a[i]=e;
    }
    e=1;
    for(int i=0;i<b;i++){
      x=1;
      while(true){
	if(a[j]<=c) break;
	a[j]/=2;
	x++;
      }
      q=0;
      for(int k=0;k<x-1;k++) {
	y=2;
	y=y<<k;
	q=(y+q);//%1000000007;
      }
    j++;
    d=(d+q);//%1000000007;
    }
    cout<<d+b<<"\n";
}


Measured memory_bytes: 256
using System;
using System.Linq;
class c
{
    static void Main()
    {
        var s = Console.ReadLine().OrderBy(f => f).ToArray();
        Console.WriteLine((s.Distinct().Count() == 2 && s[0] == s[1] && s[2] == s[3]) ? "Yes" : "No");
    }
}

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

int main(){
	int w, a, b, temp;
	cin>>w>>a>>b;
	if(b<a){
		temp=a;
		a=b;
		b=temp;
	}
	temp=b-(a+w);
	if(temp<0){
		temp=0;
	}
	cout<<temp<<endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let (a, b, t) = i.read3::<usize, usize, usize>();

    writeln!(o, "{}", t / a * b).unwrap();
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }

    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }
}


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

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

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

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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 F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int M, D;
  cin >> M >> D;
  int ret = 0;
  for(int i = 1; i <= M; i++) {
    for(int j = 1; j <= D; j++) {
      int x = j % 10, y = j / 10;
      if(x >= 2 && y >= 2) {
        if(x * y == i) ++ret;
      }
    }
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
'use strict'

const main = (INPUT) => {
  const input = INPUT.split('\n')
  const N = Number(input[0])
  const A = input[1].split('')
  const B = input[2].split('')
  const C = input[3].split('')
  let cnt = 0

  for (let i = 0; i < N; i++) {
    if (A[i] == B[i] && A[i] == B[i] && B[i] == C[i]) {
      continue
    }
    if (A[i] != B[i] && A[i] != C[i] && B[i] != C[i]) {
      cnt += 2
    } else if (((A[i] == B[i] && A[i] != C[i]) || (A[i] != B[i] && A[i] == C[i])) || ((A[i] == B[i] && A[i] != C[i]) || (A[i] != B[i] && A[i] == C[i]) || B[i] == C[i])) {
      cnt++
    }
  }

  console.log(cnt)
}

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


Measured memory_bytes: 21064
@A=glob<>;@l=<>;printf sort{$a-$b}map{$x=@v=//;$v[$t=$'>>2*$_&3]+=$t&&$l[$x+=10,$_]for 0..@l;$x+=abs$A[$_]-($v[$_]||1e9)for 1..3;$x-31}1..1e5

Measured memory_bytes: 14080
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations

import numpy as np

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def solve():
    mod = 1000000007
    N, M = il()
    a = [True] * (N+1)
    for b in imi(M):
        a[b] = False
    dp = [0] * (N + 1)
    dp[0] = 1
    for now in range(N):
        for next in range(now + 1, min(N, now + 2)+1):
            if a[next]:
                dp[next] += dp[now]
                dp[next] %= mod
    return dp[N]


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 17964
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;
const int MOD = 1000000007;

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

    int n,a,b; cin >> n >> a >> b;

    cout << min(b, n*a) << endl;


    return 0;
}

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

int num[200010],sum[200010],n,k;
bool bo[200010];

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

int mn[800010],mx[800010];

inline void build(int o,int l,int r)
{
	if (l==r) { mn[o]=mx[o]=num[l];return; }
	int mid=(l+r)>>1;
	build(o<<1,l,mid);
	build(o<<1|1,mid+1,r);
	mn[o]=min(mn[o<<1],mn[o<<1|1]);
	mx[o]=max(mx[o<<1],mx[o<<1|1]);
}

inline int query1(int o,int l,int r,int x,int y)
{
	if (l>=x&&r<=y) return mn[o];
	int mid=(l+r)>>1,res=n+1;
	if (x<=mid) res=min(res,query1(o<<1,l,mid,x,y));
	if (y>mid) res=min(res,query1(o<<1|1,mid+1,r,x,y));
	return res;
}

inline int query2(int o,int l,int r,int x,int y)
{
	if (l>=x&&r<=y) return mx[o];
	int mid=(l+r)>>1,res=0;
	if (x<=mid) res=max(res,query2(o<<1,l,mid,x,y));
	if (y>mid) res=max(res,query2(o<<1|1,mid+1,r,x,y));
	return res;
}

int main()
{
	n=rd();k=rd();
	for (int i=1;i<=n;i++) num[i]=rd();
	for (int i=2;i<=n;i++) bo[i]=(num[i]<num[i-1]);
	for (int i=1;i<=n;i++) sum[i]=sum[i-1]+bo[i];
	build(1,1,n);
	bool flag=false;
	int ans=0;
	for (int i=1;i+k-1<=n;i++)
	{
		if (sum[i+k-1]-sum[i]==0)
		{
			if (!flag) ans++;
			flag=true;
			continue;
		}
		if (i==1) { ans++;continue; }
		if (num[i-1]==query1(1,1,n,i-1,i+k-1)&&num[i+k-1]==query2(1,1,n,i-1,i+k-1)) continue;
		ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 8064
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



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

	int h, m, s;
	h = S / 3600;
	m = (S - h * 3600) / 60;
	s = S - h * 3600 - m * 60;

	cout << h << ":" << m << ":" << s << endl;

	return 0;
}



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

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;

int main(void) {
  int h, w;
  char mark[] = {'#', '.', '#'};
  while(1) {
    cin >> h >> w;
    if(h+w == 0) break;
    rep(i, h) {
      rep(j, w) {
        cout << mark[j%2 + i%2];
      }
      cout << endl;
    }
    cout << endl;
  }
}



Measured memory_bytes: 3064
N = input()
N = int(N[-1])
if N == 2 or N == 4 or N == 5 or N == 7 or N == 9:
  print("hon")
if N == 3:
  print("bon")
if N == 0 or N == 1 or N == 6 or N == 8:
  print("pon")

Measured memory_bytes: 61896
#include "bits/stdc++.h"
using namespace std;
#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 MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> VI;
typedef vector<VI> VVI;

int main(){
    long long n,y;
    long long a,b,c;

    cin >> n >> y;
    for(long long i=0; i <= n; i++){
        for(long long j=0; j<=i; j++){
            a = n-i;
            b = i-j;
            c = j;
            if ( a*10000 + b*5000 + c*1000 == y) {
                cout << a << " " << b << " " << c << endl;
                return 0;
            }
        }
    }
    cout << "-1" << " " << "-1" <<  " " << "-1" <<endl;
    return 0;
}
   


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int N;
  cin>>N;
  if(N%10 == 7){
    cout << "Yes" << endl;
    return 0;
  }
  else if((N/10)%10 == 7){
    cout << "Yes" << endl;
    return 0;
  }
  else if((N/100)%10 == 7){
    cout << "Yes" << endl;
    return 0;
  }
  else{
    cout << "No" << endl;
    return 0;
  }
}

Measured memory_bytes: 3624
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))

max_digits = 40
ans = 0

for i in range(max_digits,-1,-1):
    num = 2**i
    count = len([1 for a in A if a&num > 0])
    if count < N/2 and num <= K:
        count = N - count
        K -= num
    ans += num * count

print(ans)

Measured memory_bytes: 14620
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#include <bitset>
#include <complex>
#include <cassert>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define GI(i) (scanf("%d",&i))
#define GLL(i) (scanf("%lld",&i))
#define GD(i)  (scanf("%lf",&i))
#define PB          push_back
#define MP          make_pair
#define MT          make_tuple
#define GET0(x)     (get<0>(x))
#define GET1(x)     (get<1>(x))
#define GET2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       (1LL<<60)
#define LLMIN       -(1LL<<60)
#define IMAX        (1<<30)
#define IMIN        -(1<<30)
typedef long long LL;
using namespace std;

LL f(LL b,LL n){
    LL res=0;
    while(0<n){
        res+=n%b;
        n/=b;
    }
    return res;
}

int main(void){
    LL N,S;
    GLL(N);GLL(S);
    for(LL i=2;i<50000000;i++)
        if(f(i,N)==S){
            printf("%lld\n",i);
            return 0;
        }
    for(LL a1=50000000;0<a1;a1--){
        LL a2=S-a1;
        if(0<=a2 && (N-a2)%a1==0 && 2<(N-a2)/a1){
            LL b=(N-a2)/a1;
            if(f(b,N)==S){
                printf("%lld\n",b);
                return 0;
            }
        }
    }
    if(S==1){
        printf("%lld\n",N);
        return 0;
    }
    if(N==S){
        printf("%lld\n",N+1);
        return 0;
    }
    printf("-1\n");
    return 0;
}



Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "Yes";
    private static final String NO = "No";

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

        int N = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();

        int[] ans = solve(N, X, Y);
        for (int i=1; i<=N-1; i++) {
            System.out.println(ans[i]);
        }

    }

    private static int[] solve(int N, int X, int Y) {
        int[] ans = new int[N];

        for (int i=1; i<=N; i++) {
            for (int j=i+1; j<=N; j++) {
                // System.err.println(i + " -> " + j + " =" + minDist(N, X, Y, i, j));
                ans[minDist(N, X, Y, i, j)]++;
            }
        }

        return ans;
    }

    private static int minDist(int N, int X, int Y, int i, int j) {
        return Math.min(j-i, Math.abs(X-i) + 1 + Math.abs(Y-j));
    }
}

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

int main() {
  int A1, A2, A3;
  cin >> A1 >> A2 >> A3;
  bool a = A1 <= A2;
  bool b = A1 <= A3;
  bool c = A2 <= A3;
  bool d = A2 <= A1;
  bool e = A3 <= A1;
  bool f = A3 <= A2;
  
  if (a && c) {
    cout << (A3-A2)+(A2-A1) << endl;
  }
  else if (b && f) {
    cout << (A2-A3)+(A3-A1) << endl;
  }
  else if (d && b) {
    cout << (A3-A1)+(A1-A2) << endl;
  }
  else if (c && e) {
    cout << (A1-A3)+(A3-A2) << endl;
  }
  else if (e && a) {
    cout << (A2-A1)+(A1-A3) << endl;
  }
  else if (f && d) {
    cout << (A1-A2)+(A2-A3) << endl;
  }
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long n;
  cin>>n;
  long long arr[n];
  for(long long i=0;i<n;i++)
     cin>>arr[i];
  long long sum=0;
  for(long long i=0;i<n-1;i++)
      for(long long j=i+1;j<n;j++)
         sum += arr[i]*arr[j];
  cout<<sum<<endl;
  return 0;
}

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

using ll = long long;

template<typename A, typename B>
void xmax(A &a, B const&b){
    if(b>a) a=b;
}
template<typename A, typename B>
void xmin(A &a, B const&b){
    if(b<a) a=b;
}
constexpr ll inf = 1e15;

//dp[i][j] = min(take last, max take other)

int main()
{
    #ifdef LOCAL_RUN
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int TTT; cin >>TTT;
    while(TTT--){
    #endif // LOCAL_RUN

    int n;
    ll z, w;
    cin >> n >> z >> w;
    vector<ll> a(n);
    for(auto &e:a) cin >> e;
    reverse(a.begin(), a.end());
    a.push_back(w);
    a.push_back(z);
    n+=2;

    vector<vector<ll> > DP(n, vector<ll>(n, -1));

    vector<vector<ll>> premax(n, vector<ll>(n, -inf));
    vector<vector<ll>> premin(n, vector<ll>(n, inf));
    for(int i=1;i<n;++i){
        DP[0][i] = DP[i][0] = abs(a[i]-a[0]);
        xmin(premin[0][i], premin[0][i-1]);
        xmin(premin[0][i], DP[0][i]);
        xmax(premax[0][i], DP[0][i]);
        xmax(premax[i][0], premax[i-1][0]);
        xmax(premax[i][0], DP[i][0]);
        xmin(premin[i][0], DP[i][0]);
    }
    for(int i=1;i<n;++i){
        for(int j=1;j<n;++j){
            if(i>j){ // X to move with i
                DP[i][j] = -inf;
                DP[i][j] = premax[j-1][j];
                /*for(int k=0;k<j;++k){
                    xmax(DP[i][j], DP[k][j]);
                }*/
            } else if(j>i){
                DP[i][j] = inf;
                DP[i][j] = premin[i][i-1];
                /*for(int k=0;k<i;++k){
                    xmin(DP[i][j], DP[i][k]);
                }*/
            }
            xmax(premax[i][j], premax[i-1][j]);
            xmin(premin[i][j], premin[i][j-1]);
            if(i!=j){
                xmax(premax[i][j], DP[i][j]);
                xmin(premin[i][j], DP[i][j]);
            }
            //cerr << i << " / " << j << " : " << DP[i][j] << "\n";
        }
    }
    cout << DP[n-1][n-2] << "\n";

    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
    return 0;
}


Measured memory_bytes: 94464
/*g++ main.cpp -o main.out*/
/*./main.out*/

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

struct P
{
    int a,b;
}p[100005];

bool cmp(P A,P B)
{
    if(A.b!=B.b)
        return A.b<B.b;
    return A.a<B.a;
}

int main()
{
    NO_TLE
    int n,m;
    cin>>n>>m;
    rep(i,m)cin>>p[i].a>>p[i].b;
    sort(p,p+m,cmp);
    int ans=1,t=p[0].b;
    rep(i,m)if(p[i].a>=t)
    {
        ans++;
        t=p[i].b;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
# coding: utf-8
# Your code here!
S=[i for i in input()]
T=[i for i in input()]
N=len(S)
flg=0
for i in range(N):
    if S==T:
        print('Yes')
        flg=1
        break
    else:
        S.insert(0,S[N-1])
        del S[N]
if flg==0:
    print('No')

Measured memory_bytes: 38256
class Array
  def med
    if size.odd?
      self[size/2]
    else
      (self[size/2] + self[size/2-1]) / 2.0
    end
  end
end

n = gets.to_s.to_i
a, b = Array.new(n){ gets.to_s.split.map{|e| e.to_i } }.transpose

a.sort!
b.sort!

ans = 0
if n.odd?
  ans = [0, b.med - a.med + 1].max
else
  ans = [0, ( b.med - a.med ) * 2 + 1].max.to_i
end

puts ans


Measured memory_bytes: 32752
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N, M;
std::string s[112], t[112];

int main()
{
	in >> N;
	rep(i, N) in >> s[i];
	in >> M;
	rep(i, M) in >> t[i];
	int ans = 0;
	rep(i, N)
	{
		int res = 0;
		rep(j, N)
		{
			if (s[i] == s[j]) ++res;
		}
		rep(j, M)
		{
			if (s[i] == t[j]) --res;
		}
		ans = std::max(ans, res);
	}
	out << ans << std::endl;
	return 0;
}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

#define INF 100000000

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

	vi seq(N);
	for (int n = 0; n < N; n++)
		cin >> seq[n];

	int s = 0;
	for (int n = 0; n < N; n++)
		if (seq[n] < seq[s])
			s = n;

	int steps = 0;
	int L = s, R = s;
	while (L > 0)
	{
		L -= (K-1);
		steps++;
	}
	R += -L;
	while (R < N-1)
	{
		R += (K-1);
		steps++;
	}
	cout << steps << endl;
}



Measured memory_bytes: 3760
// Ala be zekrellah tatmaenolgholoob ...
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F first
#define S second
#define MP make_pair
const int maxn = 1e5+9;
const ll mod = 1e9+7;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if (k % 2)
		cout << b - a << "\n";
	else
		cout << a - b << "\n";
}



Measured memory_bytes: 256
#S= str(input())
#T= str(input())
N = int(input())
D,X = map(int,input().split())

#A = list(map(int,input().split()))
c=0
for i in range(N):
    a=int(input())
    t=0
    while t*a<D:
        c+=1
        t+=1
print(c+X)


Measured memory_bytes: 2940
#include<iostream>
#include<map>
#include<set>
using namespace std;

map< pair<long long,long long> ,int> mp;
set<pair<long long,long long> > st;
long long ans[10];
set<pair<long long,long long > > stor[10];
int main()
{
    long long h,w,n,a,b;
    cin>>h>>w>>n;

    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        mp[make_pair(a,b)]=1;
        st.insert(make_pair(a,b));
    }
    //cout<<"\n\n";
    for(auto it=st.begin();it!=st.end();it++)
    {
        long long x=it->first,y=it->second;
        for(int u=x-2;u<=x;u++)
        {
            for(int v=y-2;v<=y;v++)
            {

                if(u<1||v<1)
                    continue;
                if(u+2>h||v+2>w)
                    continue;
                //cout<<u<<" "<<v<<" :";
                int cnt=0;
                for(int ii=0;ii<3;ii++)
                {
                    for(int jj=0;jj<3;jj++)
                    {
                        if(mp.find(make_pair(ii+u,jj+v))!=mp.end())
                        {
                            cnt++;
                        }
                    }
                }
               // cout<<cnt<<"\n";
                if(cnt==0)
                    cout<<5/0;
                stor[cnt].insert(make_pair(u,v));
            }
        }
    }
    unsigned long long ccnt=0;
    for(int i=1;i<=9;i++)
    {
        ans[i]=stor[i].size();
        ccnt+=ans[i];
    }
    ccnt=(h*w-2*h-2*w+4)-ccnt;
    cout<<ccnt<<"\n";
    for(int i=1;i<=9;i++)
        cout<<ans[i]<<"\n";
    return 0;
}


Measured memory_bytes: 68992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repi(i,x,n) for(ll i=x;i<(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    string s,t;cin>>s>>t;
    vector<vector<ll>> bac(26,vector<ll>(0));

    rep(i,siz(s)){
        bac.at(s[i]-'a').pb(i);
    }



    ll nofs=0,ind=-1;

    for(int i=0;i < siz(t);i++)
    {
        if(siz(bac[t[i]-'a'])==0){
            cout<<-1<<endl;
            return 0;
        }

        int it=upper_bound(all(bac[t[i]-'a']),ind)-bac[t[i]-'a'].begin();

        if(it==siz(bac[t[i]-'a'])){
            nofs++;
            ind=bac[t[i]-'a'][0];
        }else{
            ind=bac[t[i]-'a'][it];
        }
    }

    cout<<siz(s)*nofs + ind +1ll<<endl;


}

Measured memory_bytes: 1724
#include<stdio.h>
#define NIL -1 

static const int MAX = 500;
static const int INFTY = (1<<21);

main(){
  int n, i, j, e, sum;
  int u,v;
  int minv = INFTY;
  int M[MAX][MAX],vis[MAX],cost[MAX],pi[MAX];
  
  /* your code */

  scanf("%d", &n);
  
  for ( i = 0; i< n; i++ ){
    for ( j = 0; j < n; j++ ){
      scanf("%d", &e);
      M[i][j] = (e==-1)?INFTY:e;
    }
  }
  
  /* your code */
  for (u = 0; u<n; u++ ){
    cost[u] = INFTY;
    vis[u] = 0;  
    pi[u] = NIL;
    
  }
  cost[0] = 0;
  
  
  while ( 1 ){
    u = NIL;
    minv = INFTY;

    for (i = 0; i<n; i++ ){
      if (cost[i] < minv && !vis[i]){
	u = i;
	minv = cost[i];
      }
    }
    
    if (u  == NIL ) break;
    
    vis[u] = 1; 
    
    for (v = 0; v<n; v++ ){
      // if ( vis[v] || M[u][v] == INFTY ) continue;
      
      if ( M[u][v] < cost[v] && !vis[v]){
	cost[v] = M[u][v];
	pi[v] = u;
      }
    }
  }
  
  sum = 0;
  
  for ( i = 0; i < n; i++ ){

    if ( pi[i] != -1 ) sum += M[i][pi[i]];
  }

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

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

string f(string s) {
  if (sz(s) == 0) return "-1";
  vi a(256);
  for (char c : s) a[c] = 1;
  for (int i = s.back()-'a'; i < 26; ++i) {
    char c = 'a'+i;
    if (a[c]) continue;
    s.back() = c;
    return s;
  }
  return f(s.substr(0,sz(s)-1));
}

int main() {
  string s;
  cin>>s;
  vi a(256);
  string ans;
  rep(i,sz(s)) {
    if (a[s[i]]) {
      cout<<f(ans)<<endl;
      return 0;
    }
    a[s[i]] = 1;
    ans += s[i];
  }
  rep(i,26) {
    char c = 'a'+i;
    if (a[c]) continue;
    ans += c;
    cout<<ans<<endl;
    return 0;
  }
  cout<<f(ans)<<endl;
  return 0;
}






















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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

bool isYYMM(int depan, int belakang) {
	if(belakang >= 1 && belakang <= 12){
		return true;
	}else{
		return false;
	}
}

bool isMMYY(int depan, int belakang) {
	if(depan >= 1 && depan <= 12) {
		return true;
	}else{
		return false;
	}
}

int main(){
	string s;
	cin>>s;
	int bil = 0;;
	for(int i=0;i<s.length();i++){
		bil*=10;
		bil += s[i] - '0';
	}
	int depan = bil / 100;
	int be = bil%100;
	// printf("depan: %d belakang: %d\n",depan, be);
	if(isYYMM(depan, be) && isMMYY(depan, be)) {
		printf("AMBIGUOUS\n");
	}else if(isYYMM(depan, be) && !isMMYY(depan, be)) {
		printf("YYMM\n");
	}else if(!isYYMM(depan, be) && isMMYY(depan, be)){
		printf("MMYY\n");
	}else{
		printf("NA\n");
	}
	return 0;
};

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define repr(i, a, b) for (int i = (int)a; i > (int)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 1147483600;
const ll infl = 4e18 + 5;
const char ENDL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vii h(n);
    rep(i, n) cin >> h[i];
    int ans = 0;
    int now = 0;
    int bef = 0;
    repr(i,n-1,-1){
        if (bef<=h[i]){
            now++;
        }
        else{
            ans = max(ans, now);
            now = 1;
        }
        bef = h[i];
    }
    ans = max(ans, now);
    cout << ans-1 << ENDL;
}

Measured memory_bytes: 640
'use strict'

function Main(input) {
    let temp = input.trim().split('\n');
    let n=parseInt(temp[0]);
    let s=temp[1].trim();

    let ans=9999999;
    let w=0,b=0;
    for(let i=0;i<n;i++){
        if(s[i]=='#') b++;
        else          w++;
    }

    let cw=0;
    ans=Math.min(ans,cw+w);
    for(let i=0;i<n;i++){
        if(s[i]=='#'){ b--;cw++;}
        else         { w--;}
        
        ans=Math.min(ans,cw+w);
    }

    console.log(ans);

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> ii;

const int N = 1e5 + 5;

int ans,n,a[N];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> n;
  n = n * 2;
  for (int i = 1 ; i <= n ; i++)
    cin >> a[i];
  sort(a + 1,a + n + 1);
  for (int i = 1 ; i <= n ; i += 2)
    ans += min(a[i],a[i + 1]);
  cout << ans << endl;
}

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

typedef long long ll;

const int inf = 1000000;

int main() {
    ll N;
    ll ans = 0;
    cin >> N;
    vector<ll>A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    ll i, j;
    ll right, left;
    left = A[0];
    right = A[N-1];
    ans += abs(right-left);
    i = 1;
    j = N-2;
    while (i <= j) {
        ll a, b, c, d;
        ll m;
        a = abs(left-A[i]);
        b = abs(left-A[j]);
        c = abs(right-A[i]);
        d = abs(right-A[j]);
        m = max({a, b, c, d}); 
        if (m == a) {
            ans += m;
            left = A[i];
            i++;
        } else if (m == b) {
            ans += m;
            left = A[j];
            j--;
        } else if (m == c) {
            ans += m;
            right = A[i];
            i++;
        } else {
            ans += m;
            right = A[j];
            j--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
  /******input******/
  int N;
  cin >> N;
  int V[N],C[N];
  for(int i = 0; i < N; i++){
    cin >> V[i];
  }
  for(int i = 0; i < N; i++){
    cin >> C[i];
  }
  /******input******/


  /******sort******/
  int Subt[N]; // V[i]-C[i]
  for(int i = 0; i < N; i++){
    Subt[i] = V[i]-C[i];
  }
  sort(Subt, &Subt[N], greater<int>());
  /******sort******/


  /******search max value******/
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(Subt[i] > 0 ){
      ans += Subt[i];
      continue;
    }
    else{
    break;
    }
  }
  /******search max value******/
  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;

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

    int sum = 0;

    for(int i = 1; i <= N; i++){
        sum += i;
    }

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
data_map = [[0] + [1]*1001 + [0]*3000, [0]*4002, [0]*4002, [0]*4002]
for i in range(1,4):
  for j in range(1,4002):
    k = 0 if j < 1000 else j+1-1001
    data_map[i][j] = sum(data_map[i-1][k:j+1])

while True:
  try:
    line = int(raw_input())
  except:
    break
  print data_map[3][line+1]

Measured memory_bytes: 4460
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll i;
    for(i=0;i<b;i++)
        c*=a;
    return c;
}
ll hell=1000000007;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
// mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());  put as first line of main
vector<ll> v[100005];
int vis[100005];
ll dp[100005][2];    // ith vertex ke subtree ka answer when i is colored as j
void dfs(ll i)
{
    vis[i]=1;
    ll j;
    ll ans1=1;
    int pp=0;
    ll ans2=1;
    for(j=0;j<v[i].size();j++)
    {
        if(!vis[v[i][j]])
        {   dfs(v[i][j]);
            ans1=(ans1*dp[v[i][j]][1])%hell;
            ans2=(ans2*(dp[v[i][j]][0]+dp[v[i][j]][1]))%hell;
            pp=1;
        }
    }
    if(!pp)
    {
        dp[i][0]=1;
        dp[i][1]=1;
    }

    dp[i][0]=ans1%hell;
    dp[i][1]=ans2%hell;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));
    ll n,i;
    cin>>n;
    for(i=0;i<(n-1);i++)
        {
            ll x,y;
            cin>>x>>y;
            v[x].pb(y);
            v[y].pb(x);
        }
    dfs(1);
    cout<<(dp[1][0]+dp[1][1])%hell;
    return 0;
}


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

using namespace std;

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl

const int maxn = (int)3e5+5;
typedef long long ll;


void solve(){
   int x, y;
   cin >> x >> y;

   if(x>=y || 2*x>y || y&1){
      cout << "No" << endl;
      return;
   }

   y -=(x*2);
   int baki = y/2;
   if(baki <= x){
      cout << "Yes" << endl;
   }else cout << "No" << endl;

}


int main()
{
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    //cout << "Fi Amanillah" << endl;

    int t=1;
    //cin >> t;
    while(t--){
      solve();
    }


    return 0;
}



Measured memory_bytes: 3656